Class ExpressionFactory
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char
A "split" character, "|", that is understood by some of the ExpressionFactory methods that require splitting joins in the middle of the path. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Expression
and
(Collection<Expression> expressions) static Expression
and
(Expression... expressions) static Expression
betweenDbExp
(String pathSpec, Object value1, Object value2) A convenience shortcut for building BETWEEN expressions.static Expression
betweenExp
(String pathSpec, Object value1, Object value2) A convenience shortcut for building BETWEEN expressions.static Expression
betweenExp
(Expression exp, Object value1, Object value2) static Expression
containsExp
(String pathSpec, String value) static Expression
containsExp
(Expression exp, String value) static Expression
containsIgnoreCaseExp
(String pathSpec, String value) Same ascontainsExp(String, String)
only using case-insensitive comparison.static Expression
containsIgnoreCaseExp
(Expression exp, String value) static Expression
dbIdPathExp
(String pathSpec) static Expression
static Expression
static Expression
endsWithExp
(String pathSpec, String value) static Expression
endsWithExp
(Expression exp, String value) static Expression
endsWithIgnoreCaseExp
(String pathSpec, String value) Same asendsWithExp(String, String)
only using case-insensitive comparison.static Expression
endsWithIgnoreCaseExp
(Expression exp, String value) static Expression
exists
(FluentSelect<?> subQuery) static Expression
Parses string, converting it to Expression and optionally binding positional parameters.static Expression
expFalse()
A convenience shortcut for boolean false expression.static Expression
expressionOfType
(int type) Creates a new expression for the type requested.static Expression
expTrue()
A convenience shortcut for boolean true expression.static Expression
static Expression
fullObjectExp
(Expression exp) static Expression
greaterDbExp
(String pathSpec, Object value) A convenience method to create an DB_PATH "greater than" expression.static Expression
greaterExp
(String pathSpec, Object value) A convenience method to create an OBJ_PATH "greater than" expression.static Expression
greaterExp
(Expression exp, Object value) static Expression
greaterOrEqualDbExp
(String pathSpec, Object value) A convenience method to create an DB_PATH "greater than or equal to" expression.static Expression
greaterOrEqualExp
(String pathSpec, Object value) A convenience method to create an OBJ_PATH "greater than or equal to" expression.static Expression
greaterOrEqualExp
(Expression exp, Object value) static Expression
A convenience shortcut for building IN DB expression.static Expression
inDbExp
(String pathSpec, Collection<?> values) A convenience shortcut for building IN DB expression.static Expression
A convenience shortcut for building IN DBID expression.static Expression
inDbIdExp
(String pathSpec, Collection<?> values) A convenience shortcut for building IN DBID expression.static Expression
A convenience shortcut for building IN expression.static Expression
inExp
(String pathSpec, Collection<?> values) A convenience shortcut for building IN expression.static Expression
inExp
(Expression exp, Object... values) static Expression
inExp
(Expression exp, Collection<?> values) static Expression
inExp
(Expression exp, ColumnSelect<?> subQuery) static Expression
joinExp
(int type, Collection<Expression> expressions) Joins all expressions, making a single expression.static Expression
joinExp
(int type, Expression... expressions) Joins all expressions, making a single expression.static Expression
A convenience method to create an DB_PATH "less than" expression.static Expression
A convenience method to create an OBJ_PATH "less than" expression.static Expression
lessExp
(Expression exp, Object value) static Expression
lessOrEqualDbExp
(String pathSpec, Object value) A convenience method to create an DB_PATH "less than or equal to" expression.static Expression
lessOrEqualExp
(String pathSpec, Object value) A convenience method to create an OBJ_PATH "less than or equal to" expression.static Expression
lessOrEqualExp
(Expression exp, Object value) static Expression
A convenience shortcut for building LIKE DB_PATH expression.static Expression
A convenience shortcut for building LIKE DB_PATH expression.static Expression
A convenience shortcut for building LIKE expression.static Expression
A convenience shortcut for building LIKE expression.static Expression
likeExp
(Expression exp, Object value) static Expression
likeExp
(Expression exp, Object value, char escapeChar) static Expression
likeIgnoreCaseDbExp
(String pathSpec, Object value) A convenience shortcut for building LIKE_IGNORE_CASE expression.static Expression
likeIgnoreCaseDbExp
(String pathSpec, Object value, char escapeChar) A convenience shortcut for building LIKE_IGNORE_CASE expression.static Expression
likeIgnoreCaseExp
(String pathSpec, Object value) A convenience shortcut for building LIKE_IGNORE_CASE expression.static Expression
likeIgnoreCaseExp
(String pathSpec, Object value, char escapeChar) A convenience shortcut for building LIKE_IGNORE_CASE expression.static Expression
likeIgnoreCaseExp
(Expression exp, Object value) static Expression
matchAllDbExp
(Map<String, ?> map, int pairType) Creates an expression that matches all key-values pairs inmap
.static Expression
matchAllExp
(String path, Object... values) static Expression
matchAllExp
(String path, Collection<?> values) Creates an expression to match a collection of values against a single path expression.static Expression
matchAllExp
(Map<String, ?> map, int pairType) Creates an expression that matches all key-values pairs inmap
.static Expression
matchAnyDbExp
(Map<String, ?> map, int pairType) Creates an expression that matches any of the key-values pairs inmap
.static Expression
matchAnyExp
(List<? extends Persistent> objects) Creates an expression that matches any of the objects contained in the listobjects
static Expression
matchAnyExp
(Map<String, ?> map, int pairType) Creates an expression that matches any of the key-values pairs in themap
.static Expression
matchAnyExp
(Persistent... objects) Creates an expression that matches any of the objects contained in theobjects
arraystatic Expression
matchDbExp
(String pathSpec, Object value) A convenience method to create an DB_PATH "equal to" expression.static Expression
matchDbIdExp
(String pathSpec, Object value) A convenience method to create an DBID_PATH "equal to" expression.static Expression
A convenience method to create an OBJ_PATH "equal to" expression.static Expression
matchExp
(Expression exp, Object value) static Expression
matchExp
(Persistent object) Creates an expression that matches the primary key of object inObjectId
'sIdSnapshot
for the argumentobject
.static Expression
noMatchDbExp
(String pathSpec, Object value) A convenience method to create an DB_PATH "not equal to" expression.static Expression
noMatchDbIdExp
(String pathSpec, Object value) A convenience method to create an DBID_PATH "not equal to" expression.static Expression
noMatchExp
(String pathSpec, Object value) A convenience method to create an OBJ_PATH "not equal to" expression.static Expression
noMatchExp
(Expression exp, Object value) static Expression
notBetweenDbExp
(String pathSpec, Object value1, Object value2) A convenience shortcut for building NOT_BETWEEN expressions.static Expression
notBetweenExp
(String pathSpec, Object value1, Object value2) A convenience shortcut for building NOT_BETWEEN expressions.static Expression
notBetweenExp
(Expression exp, Object value1, Object value2) static Expression
notExists
(FluentSelect<?> subQuery) static Expression
notInDbExp
(String pathSpec, Object... values) A convenience shortcut for building NOT_IN expression.static Expression
notInDbExp
(String pathSpec, Collection<?> values) A convenience shortcut for building NOT_IN expression.static Expression
notInDbIdExp
(String pathSpec, Object... values) A convenience shortcut for building NOT_IN expression.static Expression
notInDbIdExp
(String pathSpec, Collection<?> values) A convenience shortcut for building NOT_IN expression.static Expression
A convenience shortcut for building NOT_IN expression.static Expression
notInExp
(String pathSpec, Collection<?> values) A convenience shortcut for building NOT_IN expression.static Expression
notInExp
(Expression exp, Object... values) static Expression
notInExp
(Expression exp, Collection<?> values) static Expression
notInExp
(Expression exp, ColumnSelect<?> subQuery) static Expression
notLikeDbExp
(String pathSpec, Object value) A convenience shortcut for building NOT_LIKE expression.static Expression
notLikeDbExp
(String pathSpec, Object value, char escapeChar) A convenience shortcut for building NOT_LIKE expression.static Expression
notLikeExp
(String pathSpec, Object value) A convenience shortcut for building NOT_LIKE expression.static Expression
notLikeExp
(String pathSpec, Object value, char escapeChar) A convenience shortcut for building NOT_LIKE expression.static Expression
notLikeExp
(Expression exp, Object value) static Expression
notLikeExp
(Expression exp, Object value, char escapeChar) static Expression
notLikeIgnoreCaseDbExp
(String pathSpec, Object value) A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.static Expression
notLikeIgnoreCaseDbExp
(String pathSpec, Object value, char escapeChar) A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.static Expression
notLikeIgnoreCaseExp
(String pathSpec, Object value) A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.static Expression
notLikeIgnoreCaseExp
(String pathSpec, Object value, char escapeChar) A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.static Expression
notLikeIgnoreCaseExp
(Expression exp, Object value) static Expression
notLikeIgnoreCaseExp
(Expression exp, Object value, char escapeChar) static Expression
or
(Collection<Expression> expressions) static Expression
or
(Expression... expressions) static Expression
static Expression
startsWithExp
(String pathSpec, String value) static Expression
startsWithExp
(Expression exp, String value) static Expression
startsWithIgnoreCaseExp
(String pathSpec, String value) Same asstartsWithExp(String, String)
only using case-insensitive comparison.static Expression
startsWithIgnoreCaseExp
(Expression exp, String value) protected static Object
Applies a few default rules for adding operands to expressions.static Expression
wrapScalarValue
(Object value) Wrap value into ASTScalar
-
Field Details
-
SPLIT_SEPARATOR
public static final char SPLIT_SEPARATORA "split" character, "|", that is understood by some of the ExpressionFactory methods that require splitting joins in the middle of the path.- Since:
- 3.0
- See Also:
-
-
Constructor Details
-
ExpressionFactory
public ExpressionFactory()
-
-
Method Details
-
expressionOfType
Creates a new expression for the type requested. If type is unknown, ExpressionException is thrown. -
wrapPathOperand
Applies a few default rules for adding operands to expressions. In particular wraps all lists into LIST expressions. Applied only in path expressions. -
matchAnyDbExp
Creates an expression that matches any of the key-values pairs inmap
.For each pair
pairType
operator is used to build a binary expression. Key is considered to be a DB_PATH expression. OR is used to join pair binary expressions. -
matchAllDbExp
Creates an expression that matches all key-values pairs inmap
.For each pair
pairType
operator is used to build a binary expression. Key is considered to be a DB_PATH expression. AND is used to join pair binary expressions. -
matchAnyExp
Creates an expression that matches any of the key-values pairs in themap
.For each pair
pairType
operator is used to build a binary expression. Key is considered to be a OBJ_PATH expression. OR is used to join pair binary expressions. -
matchAllExp
Creates an expression that matches all key-values pairs inmap
.For each pair
pairType
operator is used to build a binary expression. Key is considered to be a OBJ_PATH expression. AND is used to join pair binary expressions. -
matchAllExp
Creates an expression to match a collection of values against a single path expression.Splits
Note that "path" argument here can use a split character (a pipe symbol - '|') instead of dot to indicate that relationship following a path should be split into a separate set of joins. There can only be one split at most. Split must always precede a relationship. E.g. "|exhibits.paintings", "exhibits|paintings", etc.
- Parameters:
path
- expressionvalues
- collection to match- Since:
- 3.0
-
matchAllExp
- Since:
- 3.0
-
matchDbExp
A convenience method to create an DB_PATH "equal to" expression. -
noMatchDbExp
A convenience method to create an DB_PATH "not equal to" expression. -
matchExp
A convenience method to create an OBJ_PATH "equal to" expression. -
matchExp
- Since:
- 4.0
- See Also:
-
noMatchExp
A convenience method to create an OBJ_PATH "not equal to" expression. -
noMatchExp
- Since:
- 4.0
- See Also:
-
matchDbIdExp
A convenience method to create an DBID_PATH "equal to" expression.- Since:
- 4.2
-
noMatchDbIdExp
A convenience method to create an DBID_PATH "not equal to" expression.- Since:
- 4.2
-
lessExp
A convenience method to create an OBJ_PATH "less than" expression. -
lessExp
- Since:
- 4.0
- See Also:
-
lessDbExp
A convenience method to create an DB_PATH "less than" expression.- Since:
- 3.0
-
lessOrEqualExp
A convenience method to create an OBJ_PATH "less than or equal to" expression. -
lessOrEqualExp
- Since:
- 4.0
- See Also:
-
lessOrEqualDbExp
A convenience method to create an DB_PATH "less than or equal to" expression.- Since:
- 3.0
-
greaterExp
A convenience method to create an OBJ_PATH "greater than" expression. -
greaterExp
- Since:
- 4.0
- See Also:
-
greaterDbExp
A convenience method to create an DB_PATH "greater than" expression.- Since:
- 3.0
-
greaterOrEqualExp
A convenience method to create an OBJ_PATH "greater than or equal to" expression. -
greaterOrEqualExp
- Since:
- 4.0
- See Also:
-
greaterOrEqualDbExp
A convenience method to create an DB_PATH "greater than or equal to" expression.- Since:
- 3.0
-
inExp
A convenience shortcut for building IN expression. Return ASTFalse for empty collection. -
inExp
- Since:
- 4.0
- See Also:
-
inDbExp
A convenience shortcut for building IN DB expression. Return ASTFalse for empty collection. -
inExp
A convenience shortcut for building IN expression. Return ASTFalse for empty collection. -
inDbIdExp
A convenience shortcut for building IN DBID expression. Return ASTFalse for empty collection.- Since:
- 4.2
-
inExp
- Since:
- 4.0
- See Also:
-
inDbExp
A convenience shortcut for building IN DB expression. Return ASTFalse for empty collection. -
inDbIdExp
A convenience shortcut for building IN DBID expression. Return ASTFalse for empty collection.- Since:
- 4.2
-
notInExp
A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection. -
notInExp
- Since:
- 4.0
- See Also:
-
notInDbExp
A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.- Since:
- 3.0
-
notInDbIdExp
A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.- Since:
- 4.2
-
notInExp
A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.- Since:
- 1.0.6
-
notInExp
- Since:
- 4.0
- See Also:
-
notInDbExp
A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.- Since:
- 3.0
-
notInDbIdExp
A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.- Since:
- 4.2
-
betweenExp
A convenience shortcut for building BETWEEN expressions. -
betweenExp
- Since:
- 4.0
- See Also:
-
betweenDbExp
A convenience shortcut for building BETWEEN expressions.- Since:
- 3.0
-
notBetweenExp
A convenience shortcut for building NOT_BETWEEN expressions. -
notBetweenExp
- Since:
- 4.0
- See Also:
-
notBetweenDbExp
A convenience shortcut for building NOT_BETWEEN expressions.- Since:
- 3.0
-
likeExp
A convenience shortcut for building LIKE expression. -
likeExp
- Since:
- 4.0
- See Also:
-
likeExp
A convenience shortcut for building LIKE expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
likeExp
- Since:
- 4.0
- See Also:
-
likeDbExp
A convenience shortcut for building LIKE DB_PATH expression.- Since:
- 3.0
-
likeDbExp
A convenience shortcut for building LIKE DB_PATH expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
notLikeExp
A convenience shortcut for building NOT_LIKE expression. -
notLikeExp
- Since:
- 4.0
- See Also:
-
notLikeExp
A convenience shortcut for building NOT_LIKE expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
notLikeExp
- Since:
- 4.0
- See Also:
-
notLikeDbExp
A convenience shortcut for building NOT_LIKE expression.- Since:
- 3.0
-
notLikeDbExp
A convenience shortcut for building NOT_LIKE expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
likeIgnoreCaseExp
A convenience shortcut for building LIKE_IGNORE_CASE expression. -
likeIgnoreCaseExp
- Since:
- 4.0
- See Also:
-
likeIgnoreCaseExp
A convenience shortcut for building LIKE_IGNORE_CASE expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
likeIgnoreCaseDbExp
A convenience shortcut for building LIKE_IGNORE_CASE expression.- Since:
- 3.0
-
likeIgnoreCaseDbExp
A convenience shortcut for building LIKE_IGNORE_CASE expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
notLikeIgnoreCaseExp
A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression. -
notLikeIgnoreCaseExp
- Since:
- 4.0
- See Also:
-
notLikeIgnoreCaseExp
A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
notLikeIgnoreCaseExp
- Since:
- 4.0
- See Also:
-
notLikeIgnoreCaseDbExp
A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.- Since:
- 3.0
-
notLikeIgnoreCaseDbExp
A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.
The escape character allows for escaping meta-characters in the LIKE clause. Note that the escape character cannot be '?'. To specify no escape character, supply 0 as the escape character.
- Since:
- 3.0.1
-
containsExp
- Returns:
- An expression for a database "LIKE" query with the value converted to a pattern matching anywhere in the String.
- Since:
- 4.0
-
containsExp
- Since:
- 4.0
- See Also:
-
startsWithExp
- Returns:
- An expression for a database "LIKE" query with the value converted to a pattern matching the beginning of the String.
- Since:
- 4.0
-
startsWithExp
- Since:
- 4.0
- See Also:
-
endsWithExp
- Returns:
- An expression for a database "LIKE" query with the value converted to a pattern matching the beginning of the String.
- Since:
- 4.0
-
endsWithExp
- Since:
- 4.0
- See Also:
-
containsIgnoreCaseExp
Same ascontainsExp(String, String)
only using case-insensitive comparison.- Since:
- 4.0
-
containsIgnoreCaseExp
- Since:
- 4.0
- See Also:
-
startsWithIgnoreCaseExp
Same asstartsWithExp(String, String)
only using case-insensitive comparison.- Since:
- 4.0
-
startsWithIgnoreCaseExp
- Since:
- 4.0
- See Also:
-
endsWithIgnoreCaseExp
Same asendsWithExp(String, String)
only using case-insensitive comparison.- Since:
- 4.0
-
endsWithIgnoreCaseExp
- Since:
- 4.0
- See Also:
-
pathExp
- Parameters:
pathSpec
- a String "obj:" path.- Returns:
- a new "obj:" path expression for the specified String path.
- Since:
- 4.0
-
dbPathExp
- Parameters:
pathSpec
- a String db: path.- Returns:
- a new "db:" path expression for the specified String path.
- Since:
- 4.0
-
dbIdPathExp
- Parameters:
pathSpec
- a String "dbid:" path- Returns:
- a new "dbid:" path expressiob fofr the specified String path
- Since:
- 4.2
-
expTrue
A convenience shortcut for boolean true expression.- Since:
- 3.0
-
expFalse
A convenience shortcut for boolean false expression.- Since:
- 3.0
-
joinExp
Joins all expressions, making a single expression.type
is used as an expression type for expressions joining each one of the items on the list.type
must be binary expression type.For example, if type is Expression.AND, resulting expression would match all expressions in the list. If type is Expression.OR, resulting expression would match any of the expressions.
-
joinExp
Joins all expressions, making a single expression.type
is used as an expression type for expressions joining each one of the items in the array.type
must be binary expression type.For example, if type is Expression.AND, resulting expression would match all expressions in the list. If type is Expression.OR, resulting expression would match any of the expressions.
- Since:
- 4.1
-
matchExp
Creates an expression that matches the primary key of object inObjectId
'sIdSnapshot
for the argumentobject
. -
matchAnyExp
Creates an expression that matches any of the objects contained in the listobjects
-
matchAnyExp
Creates an expression that matches any of the objects contained in theobjects
array -
fullObjectExp
-
fullObjectExp
-
enclosingObjectExp
- Since:
- 4.2
-
and
- Since:
- 4.0
-
and
- Since:
- 4.0
-
or
- Since:
- 4.0
-
or
- Since:
- 4.0
-
exp
Parses string, converting it to Expression and optionally binding positional parameters. If a string does not represent a semantically correct expression, an ExpressionException is thrown.Binding of parameters by name (as opposed to binding by position) can be achieved by chaining this call with
Expression.params(Map)
.- Since:
- 4.0
-
wrapScalarValue
Wrap value into ASTScalar- Since:
- 4.0
-
exists
- Parameters:
subQuery
-ObjectSelect
orColumnSelect
- Since:
- 4.2
-
notExists
- Parameters:
subQuery
-ObjectSelect
orColumnSelect
- Since:
- 4.2
-
inExp
- Since:
- 4.2
-
notInExp
- Since:
- 4.2
-