public interface ExpressionFactory
Creates standard common expressions for using in a Query Where or Having clause.
You will often not use this class directly but instead just add expressions
via the methods on ExpressionList such as
ExpressionList.gt(String, Object)
.
The ExpressionList is returned from Query.where()
.
// Example: fetch orders where status equals new or orderDate > lastWeek.
Expression newOrLastWeek =
Expr.or(Expr.eq("status", Order.Status.NEW),
Expr.gt("orderDate", lastWeek));
Query<Order> query = Ebean.createQuery(Order.class);
query.where().add(newOrLastWeek);
List<Order> list = query.findList();
...
Query.where()
Modifier and Type | Method and Description |
---|---|
Expression |
allEq(Map<String,Object> propertyMap)
All Equal - Map containing property names and their values.
|
Expression |
and(Expression expOne,
Expression expTwo)
And - join two expressions with a logical and.
|
Expression |
arrayContains(String propertyName,
Object... values)
Array contains all the given values.
|
Expression |
arrayIsEmpty(String propertyName)
Array is empty - for the given array property.
|
Expression |
arrayIsNotEmpty(String propertyName)
Array is not empty - for the given array property.
|
Expression |
arrayNotContains(String propertyName,
Object... values)
Array does not contain the given values.
|
Expression |
between(String propertyName,
Object value1,
Object value2)
Between - property between the two given values.
|
Expression |
betweenProperties(String lowProperty,
String highProperty,
Object value)
Between - value between two given properties.
|
Expression |
bitwiseAll(String propertyName,
long flags)
Add expression for ALL of the given bit flags to be set.
|
Expression |
bitwiseAnd(String propertyName,
long flags,
long match)
Add bitwise AND expression of the given bit flags to compare with the match/mask.
|
Expression |
bitwiseAny(String propertyName,
long flags)
Add expression for ANY of the given bit flags to be set.
|
<T> Junction<T> |
conjunction(Query<T> query)
Return a list of expressions that will be joined by AND's.
|
<T> Junction<T> |
conjunction(Query<T> query,
ExpressionList<T> parent)
Return a list of expressions that will be joined by AND's.
|
Expression |
contains(String propertyName,
String value)
Contains - property like %value%.
|
<T> Junction<T> |
disjunction(Query<T> query)
Return a list of expressions that will be joined by OR's.
|
<T> Junction<T> |
disjunction(Query<T> query,
ExpressionList<T> parent)
Return a list of expressions that will be joined by OR's.
|
Expression |
endsWith(String propertyName,
String value)
Ends With - property like %value.
|
Expression |
eq(String propertyName,
Object value)
Equal To - property equal to the given value.
|
ExampleExpression |
exampleLike(Object example)
Create the query by Example expression which is case sensitive and using
LikeType.RAW (you need to add you own wildcards % and _).
|
ExampleExpression |
exampleLike(Object example,
boolean caseInsensitive,
LikeType likeType)
Create the query by Example expression specifying more options.
|
Expression |
exists(Query<?> subQuery)
Exists expression
|
Expression |
ge(String propertyName,
Object value)
Greater Than or Equal to - property greater than or equal to the given
value.
|
Expression |
gt(String propertyName,
Object value)
Greater Than - property greater than the given value.
|
Expression |
icontains(String propertyName,
String value)
Case insensitive Contains - property like %value%.
|
Expression |
idEq(Object value)
Id Equal to - ID property is equal to the value.
|
Expression |
idIn(Collection<?> idCollection)
Id IN a collection of Id values.
|
Expression |
idIn(Object... idValues)
Id IN a list of Id values.
|
Expression |
iendsWith(String propertyName,
String value)
Case insensitive Ends With - property like %value.
|
Expression |
ieq(String propertyName,
String value)
Case Insensitive Equal To - property equal to the given value (typically
using a lower() function to make it case insensitive).
|
Expression |
ieqObject(String propertyName,
Object value)
Case Insensitive Equal To that allows for named parameter use.
|
ExampleExpression |
iexampleLike(Object example)
Case insensitive
exampleLike(Object) |
Expression |
ilike(String propertyName,
String value)
Case insensitive Like - property like value where the value contains the
SQL wild card characters % (percentage) and _ (underscore).
|
Expression |
in(String propertyName,
Collection<?> values)
In - property has a value in the collection of values.
|
Expression |
in(String propertyName,
Object[] values)
In - property has a value in the array of values.
|
Expression |
in(String propertyName,
Query<?> subQuery)
In - using a subQuery.
|
Expression |
ine(String propertyName,
String value)
Case Insensitive Not Equal To - property not equal to the given value (typically
using a lower() function to make it case insensitive).
|
Expression |
ineObject(String propertyName,
Object value)
Case Insensitive Not Equal To that allows for named parameter use.
|
Expression |
inPairs(Pairs pairs)
In expression using pairs of value objects.
|
Expression |
inRange(String propertyName,
Object value1,
Object value2)
In Range - property >= value1 and property < value2.
|
Expression |
isEmpty(String propertyName)
Is empty expression for collection properties.
|
Expression |
isNotEmpty(String propertyName)
Is not empty expression for collection properties.
|
Expression |
isNotNull(String propertyName)
Is Not Null - property is not null.
|
Expression |
isNull(String propertyName)
Is Null - property is null.
|
Expression |
istartsWith(String propertyName,
String value)
Case insensitive Starts With - property like value%.
|
Expression |
jsonBetween(String propertyName,
String path,
Object lowerValue,
Object upperValue)
Between - for the given path in a JSON document.
|
Expression |
jsonEqualTo(String propertyName,
String path,
Object val)
Equal to - for the given path in a JSON document.
|
Expression |
jsonExists(String propertyName,
String path)
Path exists - for the given path in a JSON document.
|
Expression |
jsonGreaterOrEqual(String propertyName,
String path,
Object val)
Greater than or equal to - for the given path in a JSON document.
|
Expression |
jsonGreaterThan(String propertyName,
String path,
Object val)
Greater than - for the given path in a JSON document.
|
Expression |
jsonLessOrEqualTo(String propertyName,
String path,
Object val)
Less than or equal to - for the given path in a JSON document.
|
Expression |
jsonLessThan(String propertyName,
String path,
Object val)
Less than - for the given path in a JSON document.
|
Expression |
jsonNotEqualTo(String propertyName,
String path,
Object val)
Not Equal to - for the given path in a JSON document.
|
Expression |
jsonNotExists(String propertyName,
String path)
Path does not exist - for the given path in a JSON document.
|
<T> Junction<T> |
junction(Junction.Type type,
Query<T> query,
ExpressionList<T> parent)
Return a Text query junction for MUST, SHOULD or MUST NOT.
|
Expression |
le(String propertyName,
Object value)
Less Than or Equal to - property less than or equal to the given value.
|
Expression |
like(String propertyName,
Object value,
boolean caseInsensitive,
LikeType likeType)
Like with support for named parameters.
|
Expression |
like(String propertyName,
String value)
Like - property like value where the value contains the SQL wild card
characters % (percentage) and _ (underscore).
|
Expression |
lt(String propertyName,
Object value)
Less Than - property less than the given value.
|
Expression |
ne(String propertyName,
Object value)
Not Equal To - property not equal to the given value.
|
Expression |
not(Expression exp)
Negate the expression (prefix it with NOT).
|
Expression |
notExists(Query<?> subQuery)
Not exists expression
|
Expression |
notIn(String propertyName,
Collection<?> values)
Not In - property has a value in the collection of values.
|
Expression |
notIn(String propertyName,
Object[] values)
Not In - property has a value in the array of values.
|
Expression |
notIn(String propertyName,
Query<?> subQuery)
Not In - using a subQuery.
|
Expression |
or(Expression expOne,
Expression expTwo)
Or - join two expressions with a logical or.
|
Expression |
raw(String raw)
Add raw expression with no parameters.
|
Expression |
raw(String raw,
Object value)
Add raw expression with a single parameter.
|
Expression |
raw(String raw,
Object[] values)
Add raw expression with an array of parameters.
|
Expression |
startsWith(String propertyName,
String value)
Starts With - property like value%.
|
Expression |
textCommonTerms(String search,
TextCommonTerms options)
Create a text common terms expression (currently doc store/Elastic only).
|
Expression |
textMatch(String propertyName,
String search,
Match options)
Create a Text Match expression (currently doc store/Elastic only).
|
Expression |
textMultiMatch(String query,
MultiMatch options)
Create a Text Multi match expression (currently doc store/Elastic only).
|
Expression |
textQueryString(String search,
TextQueryString options)
Create a text query string expression (currently doc store/Elastic only).
|
Expression |
textSimple(String search,
TextSimple options)
Create a text simple query expression (currently doc store/Elastic only).
|
Expression jsonExists(String propertyName, String path)
Expression jsonNotExists(String propertyName, String path)
Expression jsonEqualTo(String propertyName, String path, Object val)
Expression jsonNotEqualTo(String propertyName, String path, Object val)
Expression jsonGreaterThan(String propertyName, String path, Object val)
Expression jsonGreaterOrEqual(String propertyName, String path, Object val)
Expression jsonLessThan(String propertyName, String path, Object val)
Expression jsonLessOrEqualTo(String propertyName, String path, Object val)
Expression jsonBetween(String propertyName, String path, Object lowerValue, Object upperValue)
Expression arrayContains(String propertyName, Object... values)
Array support is effectively limited to Postgres at this time.
Expression arrayNotContains(String propertyName, Object... values)
Array support is effectively limited to Postgres at this time.
Expression arrayIsEmpty(String propertyName)
Array support is effectively limited to Postgres at this time.
Expression arrayIsNotEmpty(String propertyName)
Array support is effectively limited to Postgres at this time.
Expression eq(String propertyName, Object value)
Expression ne(String propertyName, Object value)
Expression ieq(String propertyName, String value)
Expression ine(String propertyName, String value)
Expression ieqObject(String propertyName, Object value)
Expression ineObject(String propertyName, Object value)
Expression inRange(String propertyName, Object value1, Object value2)
Unlike Between inRange is "half open" and usually more useful for use with dates or timestamps.
Expression between(String propertyName, Object value1, Object value2)
Expression betweenProperties(String lowProperty, String highProperty, Object value)
Expression gt(String propertyName, Object value)
Expression ge(String propertyName, Object value)
Expression lt(String propertyName, Object value)
Expression le(String propertyName, Object value)
Expression isNull(String propertyName)
Expression isNotNull(String propertyName)
ExampleExpression iexampleLike(Object example)
exampleLike(Object)
ExampleExpression exampleLike(Object example)
ExampleExpression exampleLike(Object example, boolean caseInsensitive, LikeType likeType)
Expression like(String propertyName, Object value, boolean caseInsensitive, LikeType likeType)
Expression like(String propertyName, String value)
Expression ilike(String propertyName, String value)
Expression startsWith(String propertyName, String value)
Expression istartsWith(String propertyName, String value)
Expression endsWith(String propertyName, String value)
Expression iendsWith(String propertyName, String value)
Expression contains(String propertyName, String value)
Expression icontains(String propertyName, String value)
Expression inPairs(Pairs pairs)
Expression in(String propertyName, Object[] values)
Expression in(String propertyName, Query<?> subQuery)
Expression in(String propertyName, Collection<?> values)
Expression notIn(String propertyName, Object[] values)
Expression notIn(String propertyName, Collection<?> values)
Expression notIn(String propertyName, Query<?> subQuery)
Expression exists(Query<?> subQuery)
Expression notExists(Query<?> subQuery)
Expression isEmpty(String propertyName)
Expression isNotEmpty(String propertyName)
Expression idEq(Object value)
Expression idIn(Object... idValues)
Expression idIn(Collection<?> idCollection)
Expression allEq(Map<String,Object> propertyMap)
Expression where all the property names in the map are equal to the corresponding value.
propertyMap
- a map keyed by property names.Expression bitwiseAny(String propertyName, long flags)
propertyName
- The property that holds the flags valueflags
- The flags we are looking forExpression bitwiseAll(String propertyName, long flags)
propertyName
- The property that holds the flags valueflags
- The flags we are looking forExpression bitwiseAnd(String propertyName, long flags, long match)
propertyName
- The property that holds the flags valueflags
- The flags we are looking forExpression raw(String raw, Object value)
The raw expression should contain a single ? at the location of the parameter.
Expression raw(String raw, Object[] values)
The raw expression should contain the same number of ? as there are parameters.
Expression raw(String raw)
Expression textMatch(String propertyName, String search, Match options)
Expression textMultiMatch(String query, MultiMatch options)
Expression textSimple(String search, TextSimple options)
Expression textQueryString(String search, TextQueryString options)
Expression textCommonTerms(String search, TextCommonTerms options)
Expression and(Expression expOne, Expression expTwo)
Expression or(Expression expOne, Expression expTwo)
Expression not(Expression exp)
<T> Junction<T> conjunction(Query<T> query)
<T> Junction<T> disjunction(Query<T> query)
<T> Junction<T> conjunction(Query<T> query, ExpressionList<T> parent)
<T> Junction<T> disjunction(Query<T> query, ExpressionList<T> parent)
<T> Junction<T> junction(Junction.Type type, Query<T> query, ExpressionList<T> parent)
This is doc store Elastic only.
Copyright © 2019. All rights reserved.