public class ExpressionFactory extends Object
Modifier and Type | Field and Description |
---|---|
static char |
SPLIT_SEPARATOR
A "split" character, "|", that is understood by some of the
ExpressionFactory methods that require splitting joins in the middle of
the path.
|
Constructor and Description |
---|
ExpressionFactory() |
Modifier and Type | Method and Description |
---|---|
static 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 |
containsExp(String pathSpec,
String value) |
static Expression |
containsIgnoreCaseExp(String pathSpec,
String value)
Same as
containsExp(String, String) only using case-insensitive
comparison. |
static Expression |
dbPathExp(String pathSpec) |
static Expression |
endsWithExp(String pathSpec,
String value) |
static Expression |
endsWithIgnoreCaseExp(String pathSpec,
String value)
Same as
endsWithExp(String, String) only using case-insensitive
comparison. |
static Expression |
exp(String expressionString,
Object... parameters)
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 |
fullObjectExp() |
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 |
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 |
inDbExp(String pathSpec,
Collection<?> values)
A convenience shortcut for building IN DB expression.
|
static Expression |
inDbExp(String pathSpec,
Object... values)
A convenience shortcut for building IN DB expression.
|
static Expression |
inExp(String pathSpec,
Collection<?> values)
A convenience shortcut for building IN expression.
|
static Expression |
inExp(String pathSpec,
Object... values)
A convenience shortcut for building IN expression.
|
static Expression |
joinExp(int type,
Collection<Expression> expressions)
Joins all expressions, making a single expression.
|
static Expression |
lessDbExp(String pathSpec,
Object value)
A convenience method to create an DB_PATH "less than" expression.
|
static Expression |
lessExp(String pathSpec,
Object value)
A convenience method to create an OBJ_PATH "less than" expression.
|
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 |
likeDbExp(String pathSpec,
Object value)
A convenience shortcut for building LIKE DB_PATH expression.
|
static Expression |
likeDbExp(String pathSpec,
Object value,
char escapeChar)
A convenience shortcut for building LIKE DB_PATH expression.
|
static Expression |
likeExp(String pathSpec,
Object value)
A convenience shortcut for building LIKE expression.
|
static Expression |
likeExp(String pathSpec,
Object value,
char escapeChar)
A convenience shortcut for building LIKE expression.
|
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 |
matchAllDbExp(Map<String,?> map,
int pairType)
Creates an expression that matches all key-values pairs in
map . |
static Expression |
matchAllExp(Map<String,?> map,
int pairType)
Creates an expression that matches all key-values pairs in
map . |
static Expression |
matchAllExp(String path,
Collection<?> values)
Creates an expression to match a collection of values against a single
path expression.
|
static Expression |
matchAllExp(String path,
Object... values) |
static Expression |
matchAnyDbExp(Map<String,?> map,
int pairType)
Creates an expression that matches any of the key-values pairs in
map . |
static Expression |
matchAnyExp(List<? extends Persistent> objects)
Creates an expression that matches any of the objects contained in the
list
objects |
static Expression |
matchAnyExp(Map<String,?> map,
int pairType)
Creates an expression that matches any of the key-values pairs in the
map . |
static Expression |
matchAnyExp(Persistent... objects)
Creates an expression that matches any of the objects contained in the
objects array |
static Expression |
matchDbExp(String pathSpec,
Object value)
A convenience method to create an DB_PATH "equal to" expression.
|
static Expression |
matchExp(Persistent object)
Creates an expression that matches the primary key of object in
ObjectId 's IdSnapshot for the argument
object . |
static Expression |
matchExp(String pathSpec,
Object value)
A convenience method to create an OBJ_PATH "equal to" expression.
|
static Expression |
noMatchDbExp(String pathSpec,
Object value)
A convenience method to create an DB_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 |
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 |
notInDbExp(String pathSpec,
Collection<?> values)
A convenience shortcut for building NOT_IN expression.
|
static Expression |
notInDbExp(String pathSpec,
Object... values)
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(String pathSpec,
Object... values)
A convenience shortcut for building NOT_IN expression.
|
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 |
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 |
or(Collection<Expression> expressions) |
static Expression |
or(Expression... expressions) |
static Expression |
pathExp(String pathSpec) |
static Expression |
startsWithExp(String pathSpec,
String value) |
static Expression |
startsWithIgnoreCaseExp(String pathSpec,
String value)
Same as
startsWithExp(String, String) only using
case-insensitive comparison. |
protected static Object |
wrapPathOperand(Object op)
Applies a few default rules for adding operands to expressions.
|
public static final char SPLIT_SEPARATOR
public static Expression expressionOfType(int type)
protected static Object wrapPathOperand(Object op)
public static Expression matchAnyDbExp(Map<String,?> map, int pairType)
map
.
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.
public static Expression matchAllDbExp(Map<String,?> map, int pairType)
map
.
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.
public static Expression matchAnyExp(Map<String,?> map, int pairType)
map
.
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.
public static Expression matchAllExp(String path, Collection<?> values)
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.
path
- values
- public static Expression matchAllExp(String path, Object... values)
public static Expression matchAllExp(Map<String,?> map, int pairType)
map
.
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.
public static Expression matchDbExp(String pathSpec, Object value)
public static Expression noMatchDbExp(String pathSpec, Object value)
public static Expression matchExp(String pathSpec, Object value)
public static Expression noMatchExp(String pathSpec, Object value)
public static Expression lessExp(String pathSpec, Object value)
public static Expression lessDbExp(String pathSpec, Object value)
public static Expression lessOrEqualExp(String pathSpec, Object value)
public static Expression lessOrEqualDbExp(String pathSpec, Object value)
public static Expression greaterExp(String pathSpec, Object value)
public static Expression greaterDbExp(String pathSpec, Object value)
public static Expression greaterOrEqualExp(String pathSpec, Object value)
public static Expression greaterOrEqualDbExp(String pathSpec, Object value)
public static Expression inExp(String pathSpec, Object... values)
public static Expression inDbExp(String pathSpec, Object... values)
public static Expression inExp(String pathSpec, Collection<?> values)
public static Expression inDbExp(String pathSpec, Collection<?> values)
public static Expression notInExp(String pathSpec, Collection<?> values)
public static Expression notInDbExp(String pathSpec, Collection<?> values)
public static Expression notInExp(String pathSpec, Object... values)
public static Expression notInDbExp(String pathSpec, Object... values)
public static Expression betweenExp(String pathSpec, Object value1, Object value2)
public static Expression betweenDbExp(String pathSpec, Object value1, Object value2)
public static Expression notBetweenExp(String pathSpec, Object value1, Object value2)
public static Expression notBetweenDbExp(String pathSpec, Object value1, Object value2)
public static Expression likeExp(String pathSpec, Object value)
public static Expression likeExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression likeDbExp(String pathSpec, Object value)
public static Expression likeDbExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression notLikeExp(String pathSpec, Object value)
public static Expression notLikeExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression notLikeDbExp(String pathSpec, Object value)
public static Expression notLikeDbExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression likeIgnoreCaseExp(String pathSpec, Object value)
public static Expression likeIgnoreCaseExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression likeIgnoreCaseDbExp(String pathSpec, Object value)
public static Expression likeIgnoreCaseDbExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression notLikeIgnoreCaseExp(String pathSpec, Object value)
public static Expression notLikeIgnoreCaseExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression notLikeIgnoreCaseDbExp(String pathSpec, Object value)
public static Expression notLikeIgnoreCaseDbExp(String pathSpec, Object value, char escapeChar)
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.
public static Expression containsExp(String pathSpec, String value)
public static Expression startsWithExp(String pathSpec, String value)
public static Expression endsWithExp(String pathSpec, String value)
public static Expression containsIgnoreCaseExp(String pathSpec, String value)
containsExp(String, String)
only using case-insensitive
comparison.public static Expression startsWithIgnoreCaseExp(String pathSpec, String value)
startsWithExp(String, String)
only using
case-insensitive comparison.public static Expression endsWithIgnoreCaseExp(String pathSpec, String value)
endsWithExp(String, String)
only using case-insensitive
comparison.public static Expression pathExp(String pathSpec)
pathSpec
- a String "obj:" path.public static Expression dbPathExp(String pathSpec)
pathSpec
- a String db: path.public static Expression expTrue()
public static Expression expFalse()
public static Expression joinExp(int type, Collection<Expression> expressions)
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.
public static Expression matchExp(Persistent object)
ObjectId
's IdSnapshot
for the argument
object
.public static Expression matchAnyExp(List<? extends Persistent> objects)
objects
public static Expression matchAnyExp(Persistent... objects)
objects
arraypublic static Expression fullObjectExp()
public static Expression fullObjectExp(Expression exp)
public static Expression and(Collection<Expression> expressions)
public static Expression and(Expression... expressions)
public static Expression or(Collection<Expression> expressions)
public static Expression or(Expression... expressions)
public static Expression exp(String expressionString, Object... parameters)
Binding of parameters by name (as opposed to binding by position) can be
achieved by chaining this call with Expression.params(Map)
.
Copyright © 2001–2017 Apache Cayenne. All rights reserved.