Overview | Package | Class | 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 java.lang.Object

Helper class to build expressions. Alternatively expressions can be built using `Expression.fromString(String)` method.

Author:
  Andrus Adamchik

Constructor Summary
`ExpressionFactory()`

Method Summary
`static Expression` | `betweenExp(java.lang.String pathSpec, java.lang.Object value1, java.lang.Object value2)` A convenience shortcut for building BETWEEN expressions.
`static Expression` | `expressionOfType(int type)` Creates a new expression for the type requested.
`static Expression` | `greaterExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an OBJ_PATH "greater than" expression.
`static Expression` | `greaterOrEqualExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an OBJ_PATH "greater than or equal to" expression.
`static Expression` | `inDbExp(java.lang.String pathSpec, java.util.Collection values)` A convenience shortcut for building IN DB expression.
`static Expression` | `inDbExp(java.lang.String pathSpec, java.lang.Object[] values)` A convenience shortcut for building IN DB expression.
`static Expression` | `inExp(java.lang.String pathSpec, java.util.Collection values)` A convenience shortcut for building IN expression.
`static Expression` | `inExp(java.lang.String pathSpec, java.lang.Object[] values)` A convenience shortcut for building IN expression.
`static Expression` | `joinExp(int type, java.util.List expressions)` Joins all `expressions` in a single expression.
`static Expression` | `lessExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an OBJ_PATH "less than" expression.
`static Expression` | `lessOrEqualExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an OBJ_PATH "less than or equal to" expression.
`static Expression` | `likeExp(java.lang.String pathSpec, java.lang.Object value)` A convenience shortcut for building LIKE expression.
`static Expression` | `likeIgnoreCaseExp(java.lang.String pathSpec, java.lang.Object value)` A convenience shortcut for building LIKE_IGNORE_CASE expression.
`static Expression` | `matchAllDbExp(java.util.Map map, int pairType)` Creates an expression that matches all key-values pairs in `map`.
`static Expression` | `matchAllExp(java.util.Map map, int pairType)` Creates an expression that matches all key-values pairs in `map`.
`static Expression` | `matchAnyDbExp(java.util.Map map, int pairType)` Creates an expression that matches any of the key-values pairs in `map`.
`static Expression` | `matchAnyExp(java.util.Map map, int pairType)` Creates an expression that matches any of the key-values pairs in the `map`.
`static Expression` | `matchDbExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an DB_PATH "equal to" expression.
`static Expression` | `matchExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an OBJ_PATH "equal to" expression.
`static Expression` | `noMatchDbExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an DB_PATH "not equal to" expression.
`static Expression` | `noMatchExp(java.lang.String pathSpec, java.lang.Object value)` A convenience method to create an OBJ_PATH "not equal to" expression.
`static Expression` | `notBetweenExp(java.lang.String pathSpec, java.lang.Object value1, java.lang.Object value2)` A convenience shortcut for building NOT_BETWEEN expressions.
`static Expression` | `notInExp(java.lang.String pathSpec, java.util.Collection values)` A convenience shortcut for building NOT_IN expression.
`static Expression` | `notInExp(java.lang.String pathSpec, java.lang.Object[] values)` A convenience shortcut for building NOT_IN expression.
`static Expression` | `notLikeExp(java.lang.String pathSpec, java.lang.Object value)` A convenience shortcut for building NOT_LIKE expression.
`static Expression` | `notLikeIgnoreCaseExp(java.lang.String pathSpec, java.lang.Object value)` A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.
`protected static java.lang.Object` | `wrapPathOperand(java.lang.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`

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 java.lang.Object wrapPathOperand(java.lang.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(java.util.Map 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. Therefore all keys must be java.lang.String objects, or ClassCastException is thrown. OR is used to join pair binary expressions.

### matchAllDbExp

    public static Expression matchAllDbExp(java.util.Map 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. Therefore all keys must be java.lang.String objects, or ClassCastException is thrown. AND is used to join pair binary expressions.

### matchAnyExp

    public static Expression matchAnyExp(java.util.Map 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. Therefore all keys must be java.lang.String objects, or ClassCastException is thrown. OR is used to join pair binary expressions.

### matchAllExp

    public static Expression matchAllExp(java.util.Map 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. Therefore all keys must be java.lang.String objects, or ClassCastException is thrown. AND is used to join pair binary expressions.

### matchDbExp

    public static Expression matchDbExp(java.lang.String pathSpec,
                                        java.lang.Object value)

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

### noMatchDbExp

    public static Expression noMatchDbExp(java.lang.String pathSpec,
                                          java.lang.Object value)

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

### inDbExp

    public static Expression inDbExp(java.lang.String pathSpec,
                                     java.lang.Object[] values)

  A convenience shortcut for building IN DB expression.

### inDbExp

    public static Expression inDbExp(java.lang.String pathSpec,
                                     java.util.Collection values)

  A convenience shortcut for building IN DB expression.

### matchExp

    public static Expression matchExp(java.lang.String pathSpec,
                                      java.lang.Object value)

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

### noMatchExp

    public static Expression noMatchExp(java.lang.String pathSpec,
                                        java.lang.Object value)

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

### lessExp

    public static Expression lessExp(java.lang.String pathSpec,
                                     java.lang.Object value)

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

### lessOrEqualExp

    public static Expression lessOrEqualExp(java.lang.String pathSpec,
                                            java.lang.Object value)

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

### greaterExp

    public static Expression greaterExp(java.lang.String pathSpec,
                                        java.lang.Object value)

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

### greaterOrEqualExp

    public static Expression greaterOrEqualExp(java.lang.String pathSpec,
                                               java.lang.Object value)

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

### inExp

    public static Expression inExp(java.lang.String pathSpec,
                                   java.lang.Object[] values)

  A convenience shortcut for building IN expression.

### inExp

    public static Expression inExp(java.lang.String pathSpec,
                                   java.util.Collection values)

  A convenience shortcut for building IN expression.

### notInExp

    public static Expression notInExp(java.lang.String pathSpec,
                                      java.util.Collection values)

  A convenience shortcut for building NOT_IN expression.

### notInExp

    public static Expression notInExp(java.lang.String pathSpec,
                                      java.lang.Object[] values)

  A convenience shortcut for building NOT_IN expression.

  Since:
    1.0.6

### betweenExp

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

  A convenience shortcut for building BETWEEN expressions.

### notBetweenExp

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

  A convenience shortcut for building NOT_BETWEEN expressions.

### likeExp

    public static Expression likeExp(java.lang.String pathSpec,
                                     java.lang.Object value)

  A convenience shortcut for building LIKE expression.

### notLikeExp

    public static Expression notLikeExp(java.lang.String pathSpec,
                                        java.lang.Object value)

  A convenience shortcut for building NOT_LIKE expression.

### likeIgnoreCaseExp

    public static Expression likeIgnoreCaseExp(java.lang.String pathSpec,
                                               java.lang.Object value)

  A convenience shortcut for building LIKE_IGNORE_CASE expression.

### notLikeIgnoreCaseExp

    public static Expression notLikeIgnoreCaseExp(java.lang.String pathSpec,
                                                  java.lang.Object value)

  A convenience shortcut for building NOT_LIKE_IGNORE_CASE expression.

### joinExp

    public static Expression joinExp(int type,
                                     java.util.List 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 | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.