java.lang.Object
io.ebean.typequery.TQProperty<R,T>
io.ebean.typequery.TQPropertyBase<R,T>
io.ebean.typequery.PBaseValueEqual<R,T>
- Type Parameters:
R- the root query bean typeT- the number type
- All Implemented Interfaces:
io.ebean.Query.Property<T>
- Direct Known Subclasses:
PBaseComparable,PBoolean,PByteArray,PEnum,PScalar,PUuid
Base property for types that primarily have equal to.
-
Field Summary
Fields inherited from class io.ebean.typequery.TQProperty
_name, _root -
Constructor Summary
ConstructorsConstructorDescriptionPBaseValueEqual(String name, R root) Construct with a property name and root instance.PBaseValueEqual(String name, R root, String prefix) Construct with additional path prefix. -
Method Summary
Modifier and TypeMethodDescriptionfinal RasMapKey()Set the property as the map key for afindMapquery.final RIs equal to another property.final Req(io.ebean.Query<?> subQuery) Property is equal to the result of a sub-query.final RIs equal to.final ReqIfPresent(@Nullable T value) Is equal to if value is non-null and otherwise no expression is added to the query.final RIs equal to or Null.final ReqSubQuery(String sqlSubQuery, Object... bindValues) Equal To a raw SQL SubQuery.final RIs equal to.final RequalToOrNull(T value) Is equal to or Null.final Rin(io.ebean.Query<?> subQuery) Is in the result of a subquery.final Rin(Collection<T> values) Is in a list of values.final RIs in a list of values.final RinOrEmpty(Collection<T> values) In where null or empty values means that no predicate is added to the query.final RinSubQuery(String sqlSubQuery, Object... bindValues) IN a raw SQL SubQuery.final RisIn(io.ebean.Query<?> subQuery) Is in the result of a sub-query.final RisIn(Collection<T> values) Is in a list of values.final RIs in a list of values.final RIs not equal to another property.final Rne(io.ebean.Query<?> subQuery) Property is not equal to the result of a sub-query.final RIs not equal to.final RneSubQuery(String sqlSubQuery, Object... bindValues) Not Equal To a raw SQL SubQuery.final RnotEqualTo(T value) Is not equal to.final RnotIn(io.ebean.Query<?> subQuery) Is NOT in the result of a sub-query.final RnotIn(Collection<T> values) Is NOT in a list of values.final RIs NOT in a list of values.final RnotInSubQuery(String sqlSubQuery, Object... bindValues) Not IN a raw SQL SubQuery.Methods inherited from class io.ebean.typequery.TQPropertyBase
asc, descMethods inherited from class io.ebean.typequery.TQProperty
expr, isNotNull, isNull, propertyName, toString
-
Constructor Details
-
PBaseValueEqual
Construct with a property name and root instance.- Parameters:
name- property nameroot- the root query bean instance
-
PBaseValueEqual
Construct with additional path prefix.
-
-
Method Details
-
asMapKey
Set the property as the map key for afindMapquery.Map<String, Customer> map = new QCustomer() .organisation.id.equalTo(42) .email.asMapKey() // email property as map key .findMap();- Returns:
- the root query bean instance
-
equalToOrNull
Is equal to or Null.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
equalTo
Is equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
eq
Is equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
eq
Is equal to another property.- Parameters:
other- the other property to compare- Returns:
- the root query bean instance
-
eqIfPresent
Is equal to if value is non-null and otherwise no expression is added to the query.That is, only add the EQUAL TO predicate if the value is not null.
This is the EQUAL TO equivalent to
inOrEmpty(Collection)where the expression/predicate is only added to the query when the value is non-null.This is effectively a helper method that allows a query to be built in fluid style where some predicates are effectively optional. We can use
eqIfPresent()rather than having a separate if block.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
eqOrNull
Is equal to or Null.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
notEqualTo
Is not equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
ne
Is not equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
ne
Is not equal to another property.- Parameters:
other- the other property to compare- Returns:
- the root query bean instance
-
in
Is in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
inOrEmpty
In where null or empty values means that no predicate is added to the query.That is, only add the IN predicate if the values are not null or empty.
Without this we typically need to code an
ifblock to only add the IN predicate if the collection is not empty like:Without inOrEmpty()
List<String> names = Arrays.asList("foo", "bar"); QCustomer query = new QCustomer() .registered.before(LocalDate.now()) // conditionally add the IN expression to the query if (names != null && !names.isEmpty()) { query.name.in(names) } query.findList();Using inOrEmpty()
List<String> names = Arrays.asList("foo", "bar"); new QCustomer() .registered.before(LocalDate.now()) .name.inOrEmpty(names) .findList(); -
notIn
Is NOT in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
isIn
Is in a list of values. Synonym for in().- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
in
Is in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
notIn
Is NOT in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
isIn
Is in a list of values. Synonym for in().- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
in
Is in the result of a subquery.- Parameters:
subQuery- values provided by a subQuery- Returns:
- the root query bean instance
-
isIn
Is in the result of a sub-query. Synonym for in().- Parameters:
subQuery- values provided by a subQuery- Returns:
- the root query bean instance
-
notIn
Is NOT in the result of a sub-query.- Parameters:
subQuery- values provided by a subQuery- Returns:
- the root query bean instance
-
inSubQuery
IN a raw SQL SubQuery.- Parameters:
sqlSubQuery- The SQL SubQuerybindValues- Optional bind values if the SubQuery uses?bind values.
-
notInSubQuery
Not IN a raw SQL SubQuery.- Parameters:
sqlSubQuery- The SQL SubQuerybindValues- Optional bind values if the SubQuery uses?bind values.
-
eqSubQuery
Equal To a raw SQL SubQuery.- Parameters:
sqlSubQuery- The SQL SubQuerybindValues- Optional bind values if the SubQuery uses?bind values.
-
neSubQuery
Not Equal To a raw SQL SubQuery.- Parameters:
sqlSubQuery- The SQL SubQuerybindValues- Optional bind values if the SubQuery uses?bind values.
-
eq
Property is equal to the result of a sub-query.- Parameters:
subQuery- value provided by a subQuery- Returns:
- the root query bean instance
-
ne
Property is not equal to the result of a sub-query.- Parameters:
subQuery- value provided by a subQuery- Returns:
- the root query bean instance
-