Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.exp
Class ExpressionFactory

    java.lang.Object
      org.apache.cayenne.exp.ExpressionFactory

    public class ExpressionFactory

extends Object

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` | `likeExp(String pathSpec, Object value)` 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` | `likeIgnoreCaseExp(String pathSpec, Object value)` 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(Map<String,?> map, int pairType)` Creates an expression that matches any of the key-values pairs in the `map`.
`static Expression` | `matchDbExp(String pathSpec, Object value)` A convenience method to create an DB_PATH "equal to" expression.
`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` | `notLikeExp(String pathSpec, Object value)` 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` | `notLikeIgnoreCaseExp(String pathSpec, Object value)` 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

### SPLIT_SEPARATOR

    public static final 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.

  Since:
    3.0
  See Also:
    Constant Field Values

Constructor Detail

### ExpressionFactory

    public ExpressionFactory()

Method Detail

### expressionOfType

    public static Expression expressionOfType(int type)

  Creates a new expression for the type requested. If type is unknown, ExpressionException is thrown.

### wrapPathOperand

    protected static Object wrapPathOperand(Object op)

  Applies a few default rules for adding operands to expressions. In particular wraps all lists into LIST expressions. Applied only in path expressions.

### matchAnyDbExp

    public static Expression matchAnyDbExp(Map<String,?> map,
                                           int pairType)

  Creates an expression that matches any of the key-values pairs in `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.

### matchAllDbExp

    public static Expression matchAllDbExp(Map<String,?> map,
                                           int pairType)

  Creates an expression that matches all key-values pairs in `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.

### matchAnyExp

    public static Expression matchAnyExp(Map<String,?> map,
                                         int pairType)

  Creates an expression that matches any of the key-values pairs in the `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.

### matchAllExp

    public static Expression matchAllExp(String path,
                                         Collection values)

  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` -
    `values` -
  Since:
    3.0

### matchAllExp

    public static Expression matchAllExp(String path,
                                         Object... values)

  Since:
    3.0

### matchAllExp

    public static Expression matchAllExp(Map<String,?> map,
                                         int pairType)

  Creates an expression that matches all key-values pairs in `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.

### matchDbExp

    public static Expression matchDbExp(String pathSpec,
                                        Object value)

  A convenience method to create an DB_PATH "equal to" expression.

### noMatchDbExp

    public static Expression noMatchDbExp(String pathSpec,
                                          Object value)

  A convenience method to create an DB_PATH "not equal to" expression.

### matchExp

    public static Expression matchExp(String pathSpec,
                                      Object value)

  A convenience method to create an OBJ_PATH "equal to" expression.

### noMatchExp

    public static Expression noMatchExp(String pathSpec,
                                        Object value)

  A convenience method to create an OBJ_PATH "not equal to" expression.

### lessExp

    public static Expression lessExp(String pathSpec,
                                     Object value)

  A convenience method to create an OBJ_PATH "less than" expression.

### lessDbExp

    public static Expression lessDbExp(String pathSpec,
                                       Object value)

  A convenience method to create an DB_PATH "less than" expression.

  Since:
    3.0

### lessOrEqualExp

    public static Expression lessOrEqualExp(String pathSpec,
                                            Object value)

  A convenience method to create an OBJ_PATH "less than or equal to" expression.

### lessOrEqualDbExp

    public static Expression lessOrEqualDbExp(String pathSpec,
                                              Object value)

  A convenience method to create an DB_PATH "less than or equal to" expression.

  Since:
    3.0

### greaterExp

    public static Expression greaterExp(String pathSpec,
                                        Object value)

  A convenience method to create an OBJ_PATH "greater than" expression.

### greaterDbExp

    public static Expression greaterDbExp(String pathSpec,
                                          Object value)

  A convenience method to create an DB_PATH "greater than" expression.

  Since:
    3.0

### greaterOrEqualExp

    public static Expression greaterOrEqualExp(String pathSpec,
                                               Object value)

  A convenience method to create an OBJ_PATH "greater than or equal to" expression.

### greaterOrEqualDbExp

    public static Expression greaterOrEqualDbExp(String pathSpec,
                                                 Object value)

  A convenience method to create an DB_PATH "greater than or equal to" expression.

  Since:
    3.0

### inExp

    public static Expression inExp(String pathSpec,
                                   Object... values)

  A convenience shortcut for building IN expression. Return ASTFalse for empty collection.

### inDbExp

    public static Expression inDbExp(String pathSpec,
                                     Object... values)

  A convenience shortcut for building IN DB expression. Return ASTFalse for empty collection.

### inExp

    public static Expression inExp(String pathSpec,
                                   Collection<?> values)

  A convenience shortcut for building IN expression. Return ASTFalse for empty collection.

### inDbExp

    public static Expression inDbExp(String pathSpec,
                                     Collection<?> values)

  A convenience shortcut for building IN DB expression. Return ASTFalse for empty collection.

### notInExp

    public static Expression notInExp(String pathSpec,
                                      Collection<?> values)

  A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.

### notInDbExp

    public static Expression notInDbExp(String pathSpec,
                                        Collection<?> values)

  A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.

  Since:
    3.0

### notInExp

    public static Expression notInExp(String pathSpec,
                                      Object... values)

  A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.

  Since:
    1.0.6

### notInDbExp

    public static Expression notInDbExp(String pathSpec,
                                        Object... values)

  A convenience shortcut for building NOT_IN expression. Return ASTTrue for empty collection.

  Since:
    3.0

### betweenExp

    public static Expression betweenExp(String pathSpec,
                                        Object value1,
                                        Object value2)

  A convenience shortcut for building BETWEEN expressions.

### betweenDbExp

    public static Expression betweenDbExp(String pathSpec,
                                          Object value1,
                                          Object value2)

  A convenience shortcut for building BETWEEN expressions.

  Since:
    3.0

### notBetweenExp

    public static Expression notBetweenExp(String pathSpec,
                                           Object value1,
                                           Object value2)

  A convenience shortcut for building NOT_BETWEEN expressions.

### notBetweenDbExp

    public static Expression notBetweenDbExp(String pathSpec,
                                             Object value1,
                                             Object value2)

  A convenience shortcut for building NOT_BETWEEN expressions.

  Since:
    3.0

### likeExp

    public static Expression likeExp(String pathSpec,
                                     Object value)

  A convenience shortcut for building LIKE expression.

### likeDbExp

    public static Expression likeDbExp(String pathSpec,
                                       Object value)

  A convenience shortcut for building LIKE DB_PATH expression.

  Since:
    3.0

### notLikeExp

    public static Expression notLikeExp(String pathSpec,
                                        Object value)

  A convenience shortcut for building NOT_LIKE expression.

### notLikeDbExp

    public static Expression notLikeDbExp(String pathSpec,
                                          Object value)

  A convenience shortcut for building NOT_LIKE expression.

  Since:
    3.0

### likeIgnoreCaseExp

    public static Expression likeIgnoreCaseExp(String pathSpec,
                                               Object value)

  A convenience shortcut for building LIKE_IGNORE_CASE expression.

### likeIgnoreCaseDbExp

    public static Expression likeIgnoreCaseDbExp(String pathSpec,
                                                 Object value)

  A convenience shortcut for building LIKE_IGNORE_CASE expression.

  Since:
    3.0

### notLikeIgnoreCaseExp

    public static Expression notLikeIgnoreCaseExp(String pathSpec,
                                                  Object value)

  A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.

### notLikeIgnoreCaseDbExp

    public static Expression notLikeIgnoreCaseDbExp(String pathSpec,
                                                    Object value)

  A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.

  Since:
    3.0

### expTrue

    public static Expression expTrue()

  A convenience shortcut for boolean true expression.

  Since:
    3.0

### expFalse

    public static Expression expFalse()

  A convenience shortcut for boolean false expression.

  Since:
    3.0

### joinExp

    public static Expression joinExp(int type,
                                     List<Expression> expressions)

  Joins all `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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2009 Apache Cayenne. All Rights Reserved.