|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.exp.ExpressionFactory
public class ExpressionFactory
Helper class to build expressions. Alternatively expressions can be built using
Expression.fromString(String)
method.
Field Summary | |
---|---|
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 Summary | |
---|---|
ExpressionFactory()
|
Method Summary | |
---|---|
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 |
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 |
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,
List<Expression> expressions)
Joins all expressions in 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. |
protected static Object |
wrapPathOperand(Object op)
Applies a few default rules for adding operands to expressions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char SPLIT_SEPARATOR
Constructor Detail |
---|
public ExpressionFactory()
Method Detail |
---|
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 expTrue()
public static Expression expFalse()
public static Expression joinExp(int type, List<Expression> expressions)
expressions
in 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.
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
array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |