| java.lang.Object org.jpox.store.expression.ScalarExpression
All known Subclasses: org.jpox.store.expression.ArrayExpression, org.jpox.store.expression.JoinExpression, org.jpox.store.expression.MathExpression, org.jpox.store.expression.CollectionExpression, org.jpox.store.expression.CollectionLiteral, org.jpox.store.expression.MapKeyLiteral, org.jpox.store.expression.ObjectExpression, org.jpox.store.expression.MapExpression, org.jpox.store.expression.ReferenceExpression, org.jpox.store.expression.JDOHelperExpression, org.jpox.store.expression.MapLiteral, org.jpox.store.expression.UnboundVariable, org.jpox.store.expression.CharacterExpression, org.jpox.store.expression.MapValueLiteral, org.jpox.store.expression.BooleanExpression, org.jpox.store.expression.TemporalExpression, org.jpox.store.expression.StringExpression, org.jpox.store.expression.NumericExpression, org.jpox.store.expression.ClassExpression, org.jpox.store.expression.BinaryExpression, org.jpox.store.expression.NewObjectExpression, org.jpox.store.expression.CollectionSubqueryExpression, org.jpox.store.expression.NullLiteral, org.jpox.store.expression.SqlTemporalExpression,
ScalarExpression | abstract public class ScalarExpression (Code) | | A Scalar expression in a Query. Used to compute values with a resulting type
version: $Revision: 1.34 $ |
Inner Class :protected static class Operator | |
Inner Class :protected static class MonadicOperator extends Operator | |
Inner Class :protected static class DyadicOperator extends Operator | |
Inner Class :public class ExpressionList | |
Inner Class :public static class DatastoreFieldExpression extends ScalarExpression | |
Method Summary | |
public ScalarExpression | accessField(String fieldName, boolean innerJoin) | public ScalarExpression | add(ScalarExpression expr) Additive Operator. | public BooleanExpression | and(ScalarExpression expr) Conditional And. | public ScalarExpression | as(String aliasIdentifier) | protected void | assertValidTypeForParameterComparison(ScalarExpression expr, Class type) Method to check if the passed expression when being a parameter is of a valid type for
comparison. | public ScalarExpression | callMethod(String methodName, List arguments) Invoke a function in a expression. | public ScalarExpression | cast(Class type) A cast expression converts, at run time, a value of one type to a similar value of another type;
or confirms, at compile time, that the type of an expression is boolean; or checks, at run time, that a reference
value refers to an object whose class is compatible with a specified reference type. | public void | checkForTypeAssignability() Method to mark this expression/literal as needing checking for type assignability. | public ScalarExpression | com() | public ScalarExpression | div(ScalarExpression expr) Division Operator. | public ScalarExpression | encloseWithInParentheses() | public BooleanExpression | eor(ScalarExpression expr) | public BooleanExpression | eq(ScalarExpression expr) | public boolean | equals(Object o) Equality operator providing a simple comparison of expressions. | public String | getAlias() Accessor for the alias (if any). | protected ScalarExpression | getConsistentTypeForParameterComparison(ScalarExpression expr) Convenience method to return a ScalarExpression that we can use to compare against this object. | public ExpressionList | getExpressionList() Returns the expression list.
The expressions list with atomic expressions (ScalarExpression.FieldExpression). | public LogicSetExpression | getLogicSetExpression() Accessor for the table expression being used by this expression. | public JavaTypeMapping | getMapping() Accessor for the mapping for this expression (if any). | public String | getNonAliasExpression() Accessor for the expression without any alias. | public String | getParameterName() Accessor for the parameter name that this expression/literal represents (if any). | public QueryExpression | getQueryExpression() Accessor for the query expression. | public BooleanExpression | gt(ScalarExpression expr) | public BooleanExpression | gteq(ScalarExpression expr) | public BooleanExpression | in(ScalarExpression expr) In expression. | public BooleanExpression | instanceOf(ScalarExpression expr) Type Comparison Operator instanceof
Parameters: expr - the right-hand ReferenceType expression true if the value of the RelationalExpression is not null and the reference could be cast to the ReferenceType without raising a ClassCastException. | public BooleanExpression | ior(ScalarExpression expr) Conditional OR. | public boolean | isParameter() Accessor for whether this expression/literal represents a parameter. | public BooleanExpression | lt(ScalarExpression expr) | public BooleanExpression | lteq(ScalarExpression expr) | public ScalarExpression | mod(ScalarExpression expr) Remainder Operator. | public ScalarExpression | mul(ScalarExpression expr) Multiplication Operator
Parameters: expr - the right-hand operator The binary * operator performs multiplication, producing the product of its operands. | public ScalarExpression | neg() | public BooleanExpression | not() | public BooleanExpression | noteq(ScalarExpression expr) | public void | setParameterName(String paramName) Mutator to set the parameter name that this expression/literal represents. | public ScalarExpression | sub(ScalarExpression expr) Additive Operator. | public StatementText | toStatementText(int mode) StatementText representation of this expression. | public String | toString() |
FILTER | public static int FILTER(Code) | | when translated to StatementText, the expression is generated to
be used as filter to a executing statement
|
LOCALISER | final protected static Localiser LOCALISER(Code) | | Localiser for messages
|
OP_ADD | final public static DyadicOperator OP_ADD(Code) | | ADD *
|
OP_AND | final public static DyadicOperator OP_AND(Code) | | AND *
|
OP_BETWEEN | final public static DyadicOperator OP_BETWEEN(Code) | | BETWEEN *
|
OP_COM | final public static MonadicOperator OP_COM(Code) | | COM *
|
OP_CONCAT | final public static DyadicOperator OP_CONCAT(Code) | | CONCAT *
|
OP_DIV | final public static DyadicOperator OP_DIV(Code) | | DIV *
|
OP_EQ | final public static DyadicOperator OP_EQ(Code) | | EQ *
|
OP_GT | final public static DyadicOperator OP_GT(Code) | | GT *
|
OP_GTEQ | final public static DyadicOperator OP_GTEQ(Code) | | GTEQ *
|
OP_IN | final public static DyadicOperator OP_IN(Code) | | IN *
|
OP_IS | final public static DyadicOperator OP_IS(Code) | | IS *
|
OP_ISNOT | final public static DyadicOperator OP_ISNOT(Code) | | ISNOT *
|
OP_LIKE | final public static DyadicOperator OP_LIKE(Code) | | LIKE *
|
OP_LT | final public static DyadicOperator OP_LT(Code) | | LT *
|
OP_LTEQ | final public static DyadicOperator OP_LTEQ(Code) | | LTEQ *
|
OP_MOD | final public static DyadicOperator OP_MOD(Code) | | MOD *
|
OP_MUL | final public static DyadicOperator OP_MUL(Code) | | MUL *
|
OP_NEG | final public static MonadicOperator OP_NEG(Code) | | NEG *
|
OP_NOT | final public static MonadicOperator OP_NOT(Code) | | NOT *
|
OP_NOTEQ | final public static DyadicOperator OP_NOTEQ(Code) | | NOTEQ *
|
OP_NOTIN | final public static DyadicOperator OP_NOTIN(Code) | | NOT IN *
|
OP_NOTLIKE | final public static DyadicOperator OP_NOTLIKE(Code) | | NOT LIKE *
|
OP_OR | final public static DyadicOperator OP_OR(Code) | | OR *
|
OP_SUB | final public static DyadicOperator OP_SUB(Code) | | SUB *
|
PROJECTION | public static int PROJECTION(Code) | | when translated to StatementText, the expression is generated to
be projected as result of executing a statement
|
aliasIdentifier | protected String aliasIdentifier(Code) | | alias identifier for this expression *
|
checkForTypeAssignability | protected boolean checkForTypeAssignability(Code) | | Flag whether we should make checks for type assignability (currently for JPA).
|
expressionList | protected ExpressionList expressionList(Code) | | List of sub-expressions. Used where we have a field that has multiple datastore mappings (one subexpression for each).
|
lowestOperator | protected Operator lowestOperator(Code) | | |
parameterName | protected String parameterName(Code) | | Name of a parameter that this expression/literal represents (if any).
|
ScalarExpression | protected ScalarExpression(QueryExpression qs)(Code) | | Constructor.
Parameters: qs - The Query Expression |
ScalarExpression | protected ScalarExpression(QueryExpression qs, JavaTypeMapping mapping, LogicSetExpression te)(Code) | | Constructor for an expression of the mapping in the specified table.
Creates a list of (field) expressions for the datastore mappings of the specified field.
Parameters: qs - The Query Expression Parameters: mapping - The field mapping Parameters: te - The table |
ScalarExpression | protected ScalarExpression(String functionName, List args)(Code) | | Generates statement as e.g. FUNCTION_NAME(arg[,argN])
Parameters: functionName - Name of the function Parameters: args - ScalarExpression list |
ScalarExpression | protected ScalarExpression(String functionName, List args, List types)(Code) | | Generates statement as e.g. FUNCTION_NAME(arg AS type[,argN as typeN])
Parameters: functionName - Name of function Parameters: args - ScalarExpression list Parameters: types - String or ScalarExpression list |
ScalarExpression | protected ScalarExpression(MonadicOperator op, ScalarExpression operand)(Code) | | Perform a function op on operand
Parameters: op - operator Parameters: operand - operand |
ScalarExpression | protected ScalarExpression(ScalarExpression operand1, DyadicOperator op, ScalarExpression operand2)(Code) | | Performs a function on two arguments.
op(operand1,operand2)
operand1 op operand2
Parameters: operand1 - the first expression Parameters: op - the operator between operands Parameters: operand2 - the second expression |
accessField | public ScalarExpression accessField(String fieldName, boolean innerJoin)(Code) | | A field access expression may access a field of an object or array, a reference to which is the value of an expression
Parameters: fieldName - the field identifier Parameters: innerJoin - true if in datastore to use inner joins; false to use left joins the field expression |
add | public ScalarExpression add(ScalarExpression expr)(Code) | | Additive Operator. The binary + operator performs addition when applied to two operands of numeric type, producing the sum of the operands. If the type of either operand of a + operator is String, then the operation is string concatenation.
Parameters: expr - the right-hand operand If one of the operands is String, the returned value is the string concatenation; The sum of two operands of numeric type. The left-hand operand is the minuend and the right-hand operand is the subtrahend; |
and | public BooleanExpression and(ScalarExpression expr)(Code) | | Conditional And. Evaluates its right-hand operand only if the value of its left-hand operand is true.
Parameters: expr - the right-hand operand the result value is true if both operand values are true; otherwise, the result is false. |
as | public ScalarExpression as(String aliasIdentifier)(Code) | | Define a new identifier for this expression
Parameters: aliasIdentifier - the alias this |
assertValidTypeForParameterComparison | protected void assertValidTypeForParameterComparison(ScalarExpression expr, Class type)(Code) | | Method to check if the passed expression when being a parameter is of a valid type for
comparison. Throws a JPOXQueryInvalidParametersException if not of the same type.
Parameters: expr - The other expression |
callMethod | public ScalarExpression callMethod(String methodName, List arguments)(Code) | | Invoke a function in a expression. The scalar expression must have
a method with the signature "methodName Method([ScalarExpression argument1, [ScalarExpression argument2],...])".
The number of arguments is equivalent to the size of the arguments list.
Parameters: methodName - the function name Parameters: arguments - the arguments the result returned when invoking the function |
cast | public ScalarExpression cast(Class type)(Code) | | A cast expression converts, at run time, a value of one type to a similar value of another type;
or confirms, at compile time, that the type of an expression is boolean; or checks, at run time, that a reference
value refers to an object whose class is compatible with a specified reference type.
The type of the operand expression must be converted to the type explicitly named by the cast operator.
Parameters: type - the type named by the cast operator the converted value |
checkForTypeAssignability | public void checkForTypeAssignability()(Code) | | Method to mark this expression/literal as needing checking for type assignability.
TODO Make this part of ObjectManager and allow ScalarExpression to reach the ObjectManager
so we don't need to propagate the info
|
com | public ScalarExpression com()(Code) | | Bitwise Complement Operator
the type of the unary bitwise complement expression is the promoted type of the operand. |
div | public ScalarExpression div(ScalarExpression expr)(Code) | | Division Operator. The left-hand operand is the dividend and the right-hand operand is the divisor.
Parameters: expr - the right-hand operator The binary / operator performs division, producing the quotient of its operands |
encloseWithInParentheses | public ScalarExpression encloseWithInParentheses()(Code) | | Method to request the enclosure of this expression within parentheses
the enclosed expression |
equals | public boolean equals(Object o)(Code) | | Equality operator providing a simple comparison of expressions.
Parameters: o - The other object Whether they are equal |
getAlias | public String getAlias()(Code) | | Accessor for the alias (if any).
Returns the alias. |
getConsistentTypeForParameterComparison | protected ScalarExpression getConsistentTypeForParameterComparison(ScalarExpression expr)(Code) | | Convenience method to return a ScalarExpression that we can use to compare against this object.
Returns the input expression unless it is for a parameter and the parameter expression has a different
datastore mapping (the default mapping whereas this has had its datastore mapping specially
selected).
Parameters: expr - The expression to check The expression to use |
getExpressionList | public ExpressionList getExpressionList()(Code) | | Returns the expression list.
The expressions list with atomic expressions (ScalarExpression.FieldExpression). A expression in this list can't be split down |
getLogicSetExpression | public LogicSetExpression getLogicSetExpression()(Code) | | Accessor for the table expression being used by this expression.
Returns the table expression for this expression. |
getMapping | public JavaTypeMapping getMapping()(Code) | | Accessor for the mapping for this expression (if any).
Returns the mapping. |
getNonAliasExpression | public String getNonAliasExpression()(Code) | | Accessor for the expression without any alias.
Returns the nonAliasExpression. |
getParameterName | public String getParameterName()(Code) | | Accessor for the parameter name that this expression/literal represents (if any).
Name of the parameter represented by this expression |
getQueryExpression | public QueryExpression getQueryExpression()(Code) | | Accessor for the query expression.
The query expression |
gt | public BooleanExpression gt(ScalarExpression expr)(Code) | | Relational operator (greater than)
Parameters: expr - the right-hand operand true if the value of the left-hand operand is greater than the value of the right-hand operand, and otherwise is false. |
gteq | public BooleanExpression gteq(ScalarExpression expr)(Code) | | Relational operator (greater than or equals)
Parameters: expr - the right-hand operand true if the value of the left-hand operand is greater than or equal the value of the right-hand operand, and otherwise is false. |
in | public BooleanExpression in(ScalarExpression expr)(Code) | | In expression. Return true if this is contained by expr
Parameters: expr - the right-hand expression true if the left-hand expression is contained by the right-hand expression. Otherwise the result is false. |
instanceOf | public BooleanExpression instanceOf(ScalarExpression expr)(Code) | | Type Comparison Operator instanceof
Parameters: expr - the right-hand ReferenceType expression true if the value of the RelationalExpression is not null and the reference could be cast to the ReferenceType without raising a ClassCastException. Otherwise the result is false. |
ior | public BooleanExpression ior(ScalarExpression expr)(Code) | | Conditional OR. Evaluates its right-hand operand only if the value of its left-hand operand is false.
Parameters: expr - the right-hand operand the result value is false if both operand values are false; otherwise, the result is true. |
isParameter | public boolean isParameter()(Code) | | Accessor for whether this expression/literal represents a parameter.
Whether a parameter is being represented. |
lt | public BooleanExpression lt(ScalarExpression expr)(Code) | | Relational operator (lower than)
Parameters: expr - the right-hand operand true if the value of the left-hand operand is less than the value of the right-hand operand, and otherwise is false. |
lteq | public BooleanExpression lteq(ScalarExpression expr)(Code) | | Relational operator (lower than or equals)
Parameters: expr - the right-hand operand true if the value of the left-hand operand is less than or equal to the value of the right-hand operand, and otherwise is false. |
mod | public ScalarExpression mod(ScalarExpression expr)(Code) | | Remainder Operator. The left-hand operand is the dividend and the right-hand operand is the divisor.
Parameters: expr - the right-hand operator The binary % operator is said to yield the remainder of its operands from an implied division |
mul | public ScalarExpression mul(ScalarExpression expr)(Code) | | Multiplication Operator
Parameters: expr - the right-hand operator The binary * operator performs multiplication, producing the product of its operands. |
neg | public ScalarExpression neg()(Code) | | Unary Minus Operator
the type of the unary minus expression is the promoted type of the operand. |
not | public BooleanExpression not()(Code) | | Logical complement
the result value is false if operand is true; otherwise, the result is true. |
setParameterName | public void setParameterName(String paramName)(Code) | | Mutator to set the parameter name that this expression/literal represents.
Parameters: paramName - Name of the parameter |
sub | public ScalarExpression sub(ScalarExpression expr)(Code) | | Additive Operator. The binary - operator subtracts right-hand operand from left-hand operand.
Parameters: expr - the right-hand operand The binary - operator performs subtraction when applied to two operands of numeric type producing the difference of its operands; the left-hand operand is the minuend and the right-hand operand is the subtrahend. |
toStatementText | public StatementText toStatementText(int mode)(Code) | | StatementText representation of this expression. I.E. A Boolean field may be stored in
boolean format like 0 or 1, and it can also be stored in other formats, like Y or N, TRUE or FALSE, and so on.
The projection mode for the boolean field is the real content of the value stored, (e.g. Y or N), and opposed to
that the filter mode for the boolean field is always represented by a boolean expression (e.g. Y=Y or N=N)
In SQL, the projection can be exemplified as "SELECT BOOLEAN_FIELD ... " and the filter as
"SELECT COLUMNS ... WHERE BOOLEAN_FIELD ='Y'"
Parameters: mode - (0=PROJECTION;1=FILTER) the StatementText |
|
|