Class QueryBuilder<T>
- java.lang.Object
-
- io.objectbox.query.QueryBuilder<T>
-
- Type Parameters:
T- Entity class for which the Query is built.
public class QueryBuilder<T> extends java.lang.ObjectBuilds aQueryusing conditions which can then be used to return a list of matching Objects.A simple example:
userBox.query() .equal(User_.firstName, "Joe", StringOrder.CASE_SENSITIVE) .order(User_.lastName) .build() .find()To add a condition use the appropriate method, for example
equal(Property, String, StringOrder)orisNull(Property). To order results useorder(Property)and its related methods.Use
build()to create aQueryobject, which is used to actually get the results.Note: by default Query returns full Objects. To return only values or an aggregate value for a single Property, use
Query.property(Property).See the Queries documentation for details.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classQueryBuilder.Operatorstatic classQueryBuilder.StringOrder
-
Field Summary
Fields Modifier and Type Field Description private Box<T>boxstatic intCASE_SENSITIVEMakes upper case letters (e.g.private QueryBuilder.OperatorcombineNextWithprivate java.util.Comparator<T>comparatorstatic intDESCENDINGReverts the order from ascending (default) to descending.private java.util.List<EagerRelation<T,?>>eagerRelationsprivate QueryFilter<T>filterprivate longhandleprivate booleanisSubQueryprivate longlastConditionHolds on to last condition.private longlastPropertyConditionHolds on to last property condition to use withparameterAlias(String)static intNULLS_LASTnull values will be put last.static intNULLS_ZEROnull values should be treated equal to zero (scalars only).private longstoreHandlestatic intUNSIGNEDFor scalars only: changes the comparison to unsigned (default is signed).
-
Constructor Summary
Constructors Modifier Constructor Description privateQueryBuilder(long storeHandle, long subQueryBuilderHandle)QueryBuilder(Box<T> box, long storeHandle, java.lang.String entityName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryBuilder<T>and()And AND changes how conditions are combined using a following OR.QueryBuilder<T>apply(QueryCondition<T> queryCondition)Applies the given query conditions and returns the builder for further customization, such as result order.<TARGET> QueryBuilder<TARGET>backlink(RelationInfo<TARGET,?> relationInfo)Creates a backlink (reversed link) to another entity, for which you also can describe conditions using the returned builder.QueryBuilder<T>between(Property<T> property, double value1, double value2)Note: New code should use thenew query API.QueryBuilder<T>between(Property<T> property, long value1, long value2)Note: New code should use thenew query API.QueryBuilder<T>between(Property<T> property, java.util.Date value1, java.util.Date value2)Note: New code should use thenew query API.Query<T>build()Builds the query and closes this QueryBuilder.private voidcheckCombineCondition(long currentCondition)private voidcheckNoOperatorPending()voidclose()Close this query builder and free used resources.private voidcombineOperator(QueryBuilder.Operator operator)QueryBuilder<T>contains(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>containsElement(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>containsKeyValue(Property<T> property, java.lang.String key, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>eager(int limit, RelationInfo relationInfo, RelationInfo... more)Likeeager(RelationInfo, RelationInfo[]), but limits eager loading to the given count.QueryBuilder<T>eager(RelationInfo relationInfo, RelationInfo... more)Specifies relations that should be resolved eagerly.QueryBuilder<T>endsWith(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>equal(Property<T> property, boolean value)Note: New code should use thenew query API.QueryBuilder<T>equal(Property<T> property, byte[] value)Note: New code should use thenew query API.QueryBuilder<T>equal(Property<T> property, double value, double tolerance)Note: New code should use thenew query API.QueryBuilder<T>equal(Property<T> property, long value)Note: New code should use thenew query API.QueryBuilder<T>equal(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>equal(Property<T> property, java.util.Date value)Note: New code should use thenew query API.QueryBuilder<T>filter(QueryFilter<T> filter)Sets a filter that executes on primary query results (returned from the db core) on a Java level.protected voidfinalize()QueryBuilder<T>greater(Property<T> property, byte[] value)Note: New code should use thenew query API.QueryBuilder<T>greater(Property<T> property, double value)Note: New code should use thenew query API.QueryBuilder<T>greater(Property<T> property, long value)Note: New code should use thenew query API.QueryBuilder<T>greater(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>greater(Property<T> property, java.util.Date value)Note: New code should use thenew query API.QueryBuilder<T>greaterOrEqual(Property<T> property, byte[] value)Note: New code should use thenew query API.QueryBuilder<T>greaterOrEqual(Property<T> property, double value)Note: New code should use thenew query API.QueryBuilder<T>greaterOrEqual(Property<T> property, long value)Note: New code should use thenew query API.QueryBuilder<T>greaterOrEqual(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>greaterOrEqual(Property<T> property, java.util.Date value)Note: New code should use thenew query API.QueryBuilder<T>in(Property<T> property, int[] values)Note: New code should use thenew query API.QueryBuilder<T>in(Property<T> property, long[] values)Note: New code should use thenew query API.QueryBuilder<T>in(Property<T> property, java.lang.String[] values, QueryBuilder.StringOrder order)Note: New code should use thenew query API.(package private) voidinternalAnd(long leftCondition, long rightCondition)(package private) longinternalGetLastCondition()(package private) voidinternalOr(long leftCondition, long rightCondition)QueryBuilder<T>isNull(Property<T> property)Note: New code should use thenew query API.QueryBuilder<T>less(Property<T> property, byte[] value)Note: New code should use thenew query API.QueryBuilder<T>less(Property<T> property, double value)Note: New code should use thenew query API.QueryBuilder<T>less(Property<T> property, long value)Note: New code should use thenew query API.QueryBuilder<T>less(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>less(Property<T> property, java.util.Date value)Note: New code should use thenew query API.QueryBuilder<T>lessOrEqual(Property<T> property, byte[] value)Note: New code should use thenew query API.QueryBuilder<T>lessOrEqual(Property<T> property, double value)Note: New code should use thenew query API.QueryBuilder<T>lessOrEqual(Property<T> property, long value)Note: New code should use thenew query API.QueryBuilder<T>lessOrEqual(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>lessOrEqual(Property<T> property, java.util.Date value)Note: New code should use thenew query API.private <TARGET> QueryBuilder<TARGET>link(RelationInfo<?,?> relationInfo, EntityInfo<?> relationOwner, EntityInfo<?> target, boolean backlink)<TARGET> QueryBuilder<TARGET>link(RelationInfo<?,TARGET> relationInfo)Creates a link to another entity, for which you also can describe conditions using the returned builder.private longnativeBetween(long handle, int propertyId, double value1, double value2)private longnativeBetween(long handle, int propertyId, long value1, long value2)private longnativeBuild(long handle)private longnativeCombine(long handle, long condition1, long condition2, boolean combineUsingOr)private longnativeContains(long handle, int propertyId, java.lang.String value, boolean caseSensitive)private longnativeContainsElement(long handle, int propertyId, java.lang.String value, boolean caseSensitive)private longnativeContainsKeyValue(long handle, int propertyId, java.lang.String key, java.lang.String value, boolean caseSensitive)private longnativeCreate(long storeHandle, java.lang.String entityName)private voidnativeDestroy(long handle)private longnativeEndsWith(long handle, int propertyId, java.lang.String value, boolean caseSensitive)private longnativeEqual(long handle, int propertyId, byte[] value)private longnativeEqual(long handle, int propertyId, long value)private longnativeEqual(long handle, int propertyId, java.lang.String value, boolean caseSensitive)private longnativeGreater(long handle, int propertyId, byte[] value, boolean withEqual)private longnativeGreater(long handle, int propertyId, double value, boolean withEqual)private longnativeGreater(long handle, int propertyId, long value, boolean withEqual)private longnativeGreater(long handle, int propertyId, java.lang.String value, boolean caseSensitive, boolean withEqual)private longnativeIn(long handle, int propertyId, int[] values, boolean negate)private longnativeIn(long handle, int propertyId, long[] values, boolean negate)private longnativeIn(long handle, int propertyId, java.lang.String[] value, boolean caseSensitive)private longnativeLess(long handle, int propertyId, byte[] value, boolean withEqual)private longnativeLess(long handle, int propertyId, double value, boolean withEqual)private longnativeLess(long handle, int propertyId, long value, boolean withEqual)private longnativeLess(long handle, int propertyId, java.lang.String value, boolean caseSensitive, boolean withEqual)private longnativeLink(long handle, long storeHandle, int relationOwnerEntityId, int targetEntityId, int propertyId, int relationId, boolean backlink)private longnativeNearestNeighborsF32(long handle, int propertyId, float[] queryVector, int maxResultCount)private longnativeNotEqual(long handle, int propertyId, long value)private longnativeNotEqual(long handle, int propertyId, java.lang.String value, boolean caseSensitive)private longnativeNotNull(long handle, int propertyId)private longnativeNull(long handle, int propertyId)private voidnativeOrder(long handle, int propertyId, int flags)private longnativeRelationCount(long handle, long storeHandle, int relationOwnerEntityId, int propertyId, int relationCount)private voidnativeSetParameterAlias(long conditionHandle, java.lang.String alias)private longnativeStartsWith(long handle, int propertyId, java.lang.String value, boolean caseSensitive)QueryBuilder<T>nearestNeighbors(Property<T> property, float[] queryVector, int maxResultCount)Note: New code should use thenew query API.QueryBuilder<T>notEqual(Property<T> property, boolean value)Note: New code should use thenew query API.QueryBuilder<T>notEqual(Property<T> property, long value)Note: New code should use thenew query API.QueryBuilder<T>notEqual(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.QueryBuilder<T>notEqual(Property<T> property, java.util.Date value)Note: New code should use thenew query API.QueryBuilder<T>notIn(Property<T> property, int[] values)Note: New code should use thenew query API.QueryBuilder<T>notIn(Property<T> property, long[] values)Note: New code should use thenew query API.QueryBuilder<T>notNull(Property<T> property)Note: New code should use thenew query API.QueryBuilder<T>or()Combines the previous condition with the following condition with a logical OR.QueryBuilder<T>order(Property<T> property)Specifies given property to be used for sorting.QueryBuilder<T>order(Property<T> property, int flags)Defines the order with which the results are ordered (default: none).QueryBuilder<T>orderDesc(Property<T> property)Specifies given property in descending order to be used for sorting.QueryBuilder<T>parameterAlias(java.lang.String alias)Note: New code should use thenew query API.QueryBuilder<T>relationCount(RelationInfo<T,?> relationInfo, int relationCount)Note: New code should use thenew query API.QueryBuilder<T>sort(java.util.Comparator<T> comparator)QueryBuilder<T>startsWith(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)Note: New code should use thenew query API.private voidverifyHandle()private voidverifyNotSubQuery()
-
-
-
Field Detail
-
DESCENDING
public static final int DESCENDING
Reverts the order from ascending (default) to descending.- See Also:
- Constant Field Values
-
CASE_SENSITIVE
public static final int CASE_SENSITIVE
Makes upper case letters (e.g. "Z") be sorted before lower case letters (e.g. "a"). If not specified, the default is case insensitive for ASCII characters.- See Also:
- Constant Field Values
-
NULLS_LAST
public static final int NULLS_LAST
null values will be put last. If not specified, by default null values will be put first.- See Also:
- Constant Field Values
-
NULLS_ZERO
public static final int NULLS_ZERO
null values should be treated equal to zero (scalars only).- See Also:
- Constant Field Values
-
UNSIGNED
public static final int UNSIGNED
For scalars only: changes the comparison to unsigned (default is signed).- See Also:
- Constant Field Values
-
storeHandle
private final long storeHandle
-
handle
private long handle
-
lastCondition
private long lastCondition
Holds on to last condition. May be a property condition or a combined condition.
-
lastPropertyCondition
private long lastPropertyCondition
Holds on to last property condition to use withparameterAlias(String)
-
combineNextWith
private QueryBuilder.Operator combineNextWith
-
eagerRelations
@Nullable private java.util.List<EagerRelation<T,?>> eagerRelations
-
filter
@Nullable private QueryFilter<T> filter
-
comparator
@Nullable private java.util.Comparator<T> comparator
-
isSubQuery
private final boolean isSubQuery
-
-
Method Detail
-
nativeCreate
private long nativeCreate(long storeHandle, java.lang.String entityName)
-
nativeDestroy
private void nativeDestroy(long handle)
-
nativeBuild
private long nativeBuild(long handle)
-
nativeLink
private long nativeLink(long handle, long storeHandle, int relationOwnerEntityId, int targetEntityId, int propertyId, int relationId, boolean backlink)
-
nativeOrder
private void nativeOrder(long handle, int propertyId, int flags)
-
nativeCombine
private long nativeCombine(long handle, long condition1, long condition2, boolean combineUsingOr)
-
nativeSetParameterAlias
private void nativeSetParameterAlias(long conditionHandle, java.lang.String alias)
-
nativeRelationCount
private long nativeRelationCount(long handle, long storeHandle, int relationOwnerEntityId, int propertyId, int relationCount)
-
nativeNull
private long nativeNull(long handle, int propertyId)
-
nativeNotNull
private long nativeNotNull(long handle, int propertyId)
-
nativeEqual
private long nativeEqual(long handle, int propertyId, long value)
-
nativeNotEqual
private long nativeNotEqual(long handle, int propertyId, long value)
-
nativeLess
private long nativeLess(long handle, int propertyId, long value, boolean withEqual)
-
nativeGreater
private long nativeGreater(long handle, int propertyId, long value, boolean withEqual)
-
nativeBetween
private long nativeBetween(long handle, int propertyId, long value1, long value2)
-
nativeIn
private long nativeIn(long handle, int propertyId, int[] values, boolean negate)
-
nativeIn
private long nativeIn(long handle, int propertyId, long[] values, boolean negate)
-
nativeEqual
private long nativeEqual(long handle, int propertyId, java.lang.String value, boolean caseSensitive)
-
nativeNotEqual
private long nativeNotEqual(long handle, int propertyId, java.lang.String value, boolean caseSensitive)
-
nativeContains
private long nativeContains(long handle, int propertyId, java.lang.String value, boolean caseSensitive)
-
nativeContainsElement
private long nativeContainsElement(long handle, int propertyId, java.lang.String value, boolean caseSensitive)
-
nativeContainsKeyValue
private long nativeContainsKeyValue(long handle, int propertyId, java.lang.String key, java.lang.String value, boolean caseSensitive)
-
nativeStartsWith
private long nativeStartsWith(long handle, int propertyId, java.lang.String value, boolean caseSensitive)
-
nativeEndsWith
private long nativeEndsWith(long handle, int propertyId, java.lang.String value, boolean caseSensitive)
-
nativeLess
private long nativeLess(long handle, int propertyId, java.lang.String value, boolean caseSensitive, boolean withEqual)
-
nativeGreater
private long nativeGreater(long handle, int propertyId, java.lang.String value, boolean caseSensitive, boolean withEqual)
-
nativeIn
private long nativeIn(long handle, int propertyId, java.lang.String[] value, boolean caseSensitive)
-
nativeLess
private long nativeLess(long handle, int propertyId, double value, boolean withEqual)
-
nativeGreater
private long nativeGreater(long handle, int propertyId, double value, boolean withEqual)
-
nativeBetween
private long nativeBetween(long handle, int propertyId, double value1, double value2)
-
nativeNearestNeighborsF32
private long nativeNearestNeighborsF32(long handle, int propertyId, float[] queryVector, int maxResultCount)
-
nativeEqual
private long nativeEqual(long handle, int propertyId, byte[] value)
-
nativeLess
private long nativeLess(long handle, int propertyId, byte[] value, boolean withEqual)
-
nativeGreater
private long nativeGreater(long handle, int propertyId, byte[] value, boolean withEqual)
-
finalize
protected void finalize() throws java.lang.ThrowableTypicallybuild()is called on this which callsclose()and avoids expensive finalization here.If
build()is not called, make sure to explicitly callclose().- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
close
public void close()
Close this query builder and free used resources.This is not required when calling
build().
-
verifyNotSubQuery
private void verifyNotSubQuery()
-
verifyHandle
private void verifyHandle()
-
apply
public QueryBuilder<T> apply(QueryCondition<T> queryCondition)
Applies the given query conditions and returns the builder for further customization, such as result order. Build the condition using the properties from your entity underscore classes.An example with a nested OR condition:
# Java builder.apply(User_.name.equal("Jane") .and(User_.age.less(12) .or(User_.status.equal("child")))); # Kotlin builder.apply(User_.name.equal("Jane") and (User_.age.less(12) or User_.status.equal("child")))UseBox.query(QueryCondition)as a shortcut for this method.
-
order
public QueryBuilder<T> order(Property<T> property)
Specifies given property to be used for sorting. Shorthand fororder(Property, int)with flags equal to 0.- See Also:
order(Property, int),orderDesc(Property)
-
orderDesc
public QueryBuilder<T> orderDesc(Property<T> property)
Specifies given property in descending order to be used for sorting. Shorthand fororder(Property, int)with flags equal toDESCENDING.- See Also:
order(Property, int),order(Property)
-
order
public QueryBuilder<T> order(Property<T> property, int flags)
Defines the order with which the results are ordered (default: none). You can chain multiple order conditions. The first applied order condition will be the most relevant. Order conditions applied afterwards are only relevant if the preceding ones resulted in value equality.Example:
queryBuilder.order(Name).orderDesc(YearOfBirth);
Here, "Name" defines the primary sort order. The secondary sort order "YearOfBirth" is only used to compare entries with the same "Name" values.
- Parameters:
property- the property defining the orderflags- Bit flags that can be combined using the binary OR operator (|). Available flags areDESCENDING,CASE_SENSITIVE,NULLS_LAST,NULLS_ZERO, andUNSIGNED.- See Also:
order(Property),orderDesc(Property)
-
sort
public QueryBuilder<T> sort(java.util.Comparator<T> comparator)
-
parameterAlias
public QueryBuilder<T> parameterAlias(java.lang.String alias)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Assigns the given alias to the previous condition.
- Parameters:
alias- The string alias for use with setParameter(s) methods.
-
link
public <TARGET> QueryBuilder<TARGET> link(RelationInfo<?,TARGET> relationInfo)
Creates a link to another entity, for which you also can describe conditions using the returned builder.Note: in relational databases you would use a "join" for this.
- Type Parameters:
TARGET- The target entity. For parent/tree like relations, it can be the same type.- Parameters:
relationInfo- Relation meta info (generated)- Returns:
- A builder to define query conditions at the target entity side.
-
link
private <TARGET> QueryBuilder<TARGET> link(RelationInfo<?,?> relationInfo, EntityInfo<?> relationOwner, EntityInfo<?> target, boolean backlink)
-
backlink
public <TARGET> QueryBuilder<TARGET> backlink(RelationInfo<TARGET,?> relationInfo)
Creates a backlink (reversed link) to another entity, for which you also can describe conditions using the returned builder.Note: only use this method over
link(RelationInfo), if you did not define @Backlinkin the entity already.Note: in relational databases you would use a "join" for this.
- Type Parameters:
TARGET- The target entity. For parent/tree like relations, it can be the same type.- Parameters:
relationInfo- Relation meta info (generated) of the original relation (reverse direction)- Returns:
- A builder to define query conditions at the target entity side.
-
eager
public QueryBuilder<T> eager(RelationInfo relationInfo, RelationInfo... more)
Specifies relations that should be resolved eagerly. This prepares the given relation objects to be preloaded (cached) avoiding further get operations from the database.- Parameters:
relationInfo- The relation as found in the generated meta info class ("EntityName_") of class T.more- Supply further relations to be eagerly loaded.
-
eager
public QueryBuilder<T> eager(int limit, RelationInfo relationInfo, @Nullable RelationInfo... more)
Likeeager(RelationInfo, RelationInfo[]), but limits eager loading to the given count.- Parameters:
limit- Count of entities to be eager loaded.relationInfo- The relation as found in the generated meta info class ("EntityName_") of class T.more- Supply further relations to be eagerly loaded.
-
filter
public QueryBuilder<T> filter(QueryFilter<T> filter)
Sets a filter that executes on primary query results (returned from the db core) on a Java level. For efficiency reasons, you should always prefer primary criteria likeequal(Property, long)if possible. A filter requires to instantiate full Java objects beforehand, which is less efficient.The upside of filters is that they allow any complex operation including traversing object graphs, and that filtering is executed along with the query (preferably in a background thread). Use filtering wisely ;-).
Also note, that a filter may only be used along with
Query.find()andQuery.forEach(QueryConsumer)at this point. Other find methods will throw a exception and aggregate functions will silently ignore the filter.
-
or
public QueryBuilder<T> or()
Combines the previous condition with the following condition with a logical OR.Example (querying t-shirts):
queryBuilder.equal(color, "blue").or().less(price, 30).build() // color is blue OR price < 30
-
and
public QueryBuilder<T> and()
And AND changes how conditions are combined using a following OR. By default, all query conditions are already combined using AND. Do not use this method if all your query conditions must match (AND for all, this is the default).However, this method change the precedence with other combinations such as
or(). This is best explained by example.Example (querying t-shirts):
// Case (1): OR has precedence queryBuilder.equal(color, "blue").equal(size, "XL").or().less(price, 30).build() // Case (2): AND has precedence queryBuilder.equal(color, "blue").and().equal(size, "XL").or().less(price, 30).build()Rule: Explicit AND / OR combination have precedence.
That's why (1) is evaluated like "must be blue and is either of size XL or costs less than 30", or more formally: blue AND (size XL OR price less than 30).
Rule: Conditions are applied from left to right (in the order they are called).
That's why in (2) the AND is evaluated before the OR. Thus, (2) evaluates to "either must be blue and of size XL, or costs less than 30", or, more formally: (blue AND size XL) OR price less than 30.
-
combineOperator
private void combineOperator(QueryBuilder.Operator operator)
-
checkNoOperatorPending
private void checkNoOperatorPending()
-
checkCombineCondition
private void checkCombineCondition(long currentCondition)
-
internalGetLastCondition
@Internal long internalGetLastCondition()
-
internalAnd
@Internal void internalAnd(long leftCondition, long rightCondition)
-
internalOr
@Internal void internalOr(long leftCondition, long rightCondition)
-
isNull
public QueryBuilder<T> isNull(Property<T> property)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
notNull
public QueryBuilder<T> notNull(Property<T> property)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
relationCount
public QueryBuilder<T> relationCount(RelationInfo<T,?> relationInfo, int relationCount)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
equal
public QueryBuilder<T> equal(Property<T> property, long value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
notEqual
public QueryBuilder<T> notEqual(Property<T> property, long value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
less
public QueryBuilder<T> less(Property<T> property, long value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
lessOrEqual
public QueryBuilder<T> lessOrEqual(Property<T> property, long value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greater
public QueryBuilder<T> greater(Property<T> property, long value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greaterOrEqual
public QueryBuilder<T> greaterOrEqual(Property<T> property, long value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
between
public QueryBuilder<T> between(Property<T> property, long value1, long value2)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Finds objects with property value between and including the first and second value.
-
in
public QueryBuilder<T> in(Property<T> property, long[] values)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
notIn
public QueryBuilder<T> notIn(Property<T> property, long[] values)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
in
public QueryBuilder<T> in(Property<T> property, int[] values)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
notIn
public QueryBuilder<T> notIn(Property<T> property, int[] values)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
equal
public QueryBuilder<T> equal(Property<T> property, boolean value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
notEqual
public QueryBuilder<T> notEqual(Property<T> property, boolean value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
equal
public QueryBuilder<T> equal(Property<T> property, java.util.Date value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.- Throws:
java.lang.NullPointerException- if given value is null. UseisNull(Property)instead.
-
notEqual
public QueryBuilder<T> notEqual(Property<T> property, java.util.Date value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.- Throws:
java.lang.NullPointerException- if given value is null. UseisNull(Property)instead.
-
less
public QueryBuilder<T> less(Property<T> property, java.util.Date value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.- Throws:
java.lang.NullPointerException- if given value is null. UseisNull(Property)instead.
-
lessOrEqual
public QueryBuilder<T> lessOrEqual(Property<T> property, java.util.Date value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.- Throws:
java.lang.NullPointerException- if given value is null. UseisNull(Property)instead.
-
greater
public QueryBuilder<T> greater(Property<T> property, java.util.Date value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.- Throws:
java.lang.NullPointerException- if given value is null. UseisNull(Property)instead.
-
greaterOrEqual
public QueryBuilder<T> greaterOrEqual(Property<T> property, java.util.Date value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.- Throws:
java.lang.NullPointerException- if given value is null. UseisNull(Property)instead.
-
between
public QueryBuilder<T> between(Property<T> property, java.util.Date value1, java.util.Date value2)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Finds objects with property value between and including the first and second value.
- Throws:
java.lang.NullPointerException- if one of the given values is null.
-
equal
public QueryBuilder<T> equal(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Creates an "equal ('=')" condition for this property.
-
notEqual
public QueryBuilder<T> notEqual(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Creates a "not equal ('<>')" condition for this property.
-
contains
public QueryBuilder<T> contains(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Creates a contains condition.
Note: for a String array property, use
containsElement(io.objectbox.Property<T>, java.lang.String, io.objectbox.query.QueryBuilder.StringOrder)instead.
-
containsElement
public QueryBuilder<T> containsElement(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.For a String array, list or String-key map property, matches if at least one element equals the given value.
-
containsKeyValue
public QueryBuilder<T> containsKeyValue(Property<T> property, java.lang.String key, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.For a String-key map property, matches if at least one key and value combination equals the given values.
-
startsWith
public QueryBuilder<T> startsWith(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
endsWith
public QueryBuilder<T> endsWith(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
less
public QueryBuilder<T> less(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
lessOrEqual
public QueryBuilder<T> lessOrEqual(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greater
public QueryBuilder<T> greater(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greaterOrEqual
public QueryBuilder<T> greaterOrEqual(Property<T> property, java.lang.String value, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
in
public QueryBuilder<T> in(Property<T> property, java.lang.String[] values, QueryBuilder.StringOrder order)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
equal
public QueryBuilder<T> equal(Property<T> property, double value, double tolerance)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Floating point equality is non-trivial; this is just a convenience for
between(Property, double, double)with parameters(property, value - tolerance, value + tolerance). When usingQuery.setParameters(Property, double, double), consider that the params are the lower and upper bounds.
-
less
public QueryBuilder<T> less(Property<T> property, double value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
lessOrEqual
public QueryBuilder<T> lessOrEqual(Property<T> property, double value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greater
public QueryBuilder<T> greater(Property<T> property, double value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greaterOrEqual
public QueryBuilder<T> greaterOrEqual(Property<T> property, double value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
between
public QueryBuilder<T> between(Property<T> property, double value1, double value2)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.Finds objects with property value between and including the first and second value.
-
nearestNeighbors
public QueryBuilder<T> nearestNeighbors(Property<T> property, float[] queryVector, int maxResultCount)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
equal
public QueryBuilder<T> equal(Property<T> property, byte[] value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
less
public QueryBuilder<T> less(Property<T> property, byte[] value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
lessOrEqual
public QueryBuilder<T> lessOrEqual(Property<T> property, byte[] value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greater
public QueryBuilder<T> greater(Property<T> property, byte[] value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
greaterOrEqual
public QueryBuilder<T> greaterOrEqual(Property<T> property, byte[] value)
Note: New code should use thenew query API. Existing code can continue to use this, there are currently no plans to remove the old query API.
-
-