Package io.ebean.typequery
Class PBaseValueEqual<R,T>
- java.lang.Object
-
- io.ebean.typequery.TQProperty<R>
-
- io.ebean.typequery.TQPropertyBase<R>
-
- io.ebean.typequery.PBaseValueEqual<R,T>
-
- Type Parameters:
R- the root query bean typeT- the number type
- Direct Known Subclasses:
PBaseCompareable,PBoolean,PCidr,PCurrency,PEnum,PInet,PInetAddress,PTimeZone,PUuid,PZoneId,PZoneOffset
public abstract class PBaseValueEqual<R,T> extends TQPropertyBase<R>
Base property for types that primarily have equal to.
-
-
Constructor Summary
Constructors Constructor Description PBaseValueEqual(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RasMapKey()Set the property as the map key for afindMapquery.Req(T value)Is equal to.RequalTo(T value)Is equal to.RequalToOrNull(T value)Is equal to or Null.Rin(Collection<T> values)Is in a list of values.Rin(T... values)Is in a list of values.RinOrEmpty(Collection<T> values)In where null or empty values means that no predicate is added to the query.RisIn(Collection<T> values)Is in a list of values.RisIn(T... values)Is in a list of values.Rne(T value)Is not equal to.RnotEqualTo(T value)Is not equal to.RnotIn(Collection<T> values)Is NOT in a list of values.RnotIn(T... values)Is NOT in a list of values.-
Methods inherited from class io.ebean.typequery.TQPropertyBase
asc, desc
-
Methods inherited from class io.ebean.typequery.TQProperty
isNotNull, isNull, toString
-
-
-
-
Constructor Detail
-
PBaseValueEqual
public PBaseValueEqual(String name, R root)
Construct with a property name and root instance.- Parameters:
name- property nameroot- the root query bean instance
-
PBaseValueEqual
public PBaseValueEqual(String name, R root, String prefix)
Construct with additional path prefix.
-
-
Method Detail
-
asMapKey
public final R 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
public final R equalToOrNull(T value)
Is equal to or Null.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
equalTo
public final R equalTo(T value)
Is equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
eq
public final R eq(T value)
Is equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
notEqualTo
public final R notEqualTo(T value)
Is not equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
ne
public final R ne(T value)
Is not equal to.- Parameters:
value- the equal to bind value- Returns:
- the root query bean instance
-
in
@SafeVarargs public final R in(T... values)
Is in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
inOrEmpty
public final R inOrEmpty(Collection<T> values)
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
@SafeVarargs public final R notIn(T... values)
Is NOT in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
isIn
@SafeVarargs public final R isIn(T... values)
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
public final R in(Collection<T> values)
Is in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
notIn
public final R notIn(Collection<T> values)
Is NOT in a list of values.- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
isIn
public final R isIn(Collection<T> values)
Is in a list of values. Synonym for in().- Parameters:
values- the list of values for the predicate- Returns:
- the root query bean instance
-
-