- java.lang.Object
-
- org.datanucleus.store.query.expression.Expression
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ArrayExpression
,CaseExpression
,ClassExpression
,CreatorExpression
,DyadicExpression
,InvokeExpression
,JoinExpression
,Literal
,OrderExpression
,ParameterExpression
,PrimaryExpression
,SubqueryExpression
,TypeExpression
,VariableExpression
public abstract class Expression extends Object implements Serializable
A Scalar expression in a Query. Used to compute values with a resulting type.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Expression.DyadicOperator
"Dyadic" operator performs operation on one or two operands.static class
Expression.MonadicOperator
"Monadic" operator performs a function on one operand.static class
Expression.Operator
Representation of an Operator.
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
Expression()
Constructor.protected
Expression(Expression.MonadicOperator op, Expression operand)
Perform a functionop
onoperand
protected
Expression(Expression operand1, Expression.DyadicOperator op, Expression operand2)
Performs a function on two arguments.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Symbol
bind(SymbolTable symtbl)
Method to bind the expression to the symbol table as appropriate.Object
evaluate(ExpressionEvaluator eval)
Method to evaluate this expression, using the passed evaluator.String
getAlias()
Expression
getLeft()
Accessor for the left hand expression.Expression.Operator
getOperator()
The operator to be performed by this expression.Expression
getParent()
Accessor for the parent expression where this expression is access from.Expression
getRight()
Accessor for the right hand expression.Symbol
getSymbol()
Accessor for the symbol for this expression (if set).void
setAlias(String alias)
void
setLeft(Expression expr)
void
setRight(Expression expr)
-
-
-
Field Detail
-
parent
protected Expression parent
Parent of this expression in the tree (if any).
-
op
protected Expression.Operator op
-
left
protected Expression left
-
right
protected Expression right
-
symbol
protected Symbol symbol
-
alias
protected String alias
-
OP_OR
public static final Expression.DyadicOperator OP_OR
OR
-
OP_AND
public static final Expression.DyadicOperator OP_AND
AND
-
OP_NOT
public static final Expression.MonadicOperator OP_NOT
NOT
-
OP_EQ
public static final Expression.DyadicOperator OP_EQ
EQ
-
OP_NOTEQ
public static final Expression.DyadicOperator OP_NOTEQ
NOTEQ
-
OP_LT
public static final Expression.DyadicOperator OP_LT
LT
-
OP_LTEQ
public static final Expression.DyadicOperator OP_LTEQ
LTEQ
-
OP_GT
public static final Expression.DyadicOperator OP_GT
GT
-
OP_GTEQ
public static final Expression.DyadicOperator OP_GTEQ
GTEQ
-
OP_LIKE
public static final Expression.DyadicOperator OP_LIKE
LIKE
-
OP_IS
public static final Expression.DyadicOperator OP_IS
IS
-
OP_ISNOT
public static final Expression.DyadicOperator OP_ISNOT
ISNOT
-
OP_CAST
public static final Expression.DyadicOperator OP_CAST
IS
-
OP_IN
public static final Expression.DyadicOperator OP_IN
IN
-
OP_NOTIN
public static final Expression.DyadicOperator OP_NOTIN
NOTIN
-
OP_BIT_OR
public static final Expression.DyadicOperator OP_BIT_OR
BITWISE OR
-
OP_BIT_XOR
public static final Expression.DyadicOperator OP_BIT_XOR
BITWISE XOR
-
OP_BIT_AND
public static final Expression.DyadicOperator OP_BIT_AND
BITWISE AND
-
OP_ADD
public static final Expression.DyadicOperator OP_ADD
ADD
-
OP_SUB
public static final Expression.DyadicOperator OP_SUB
SUB
-
OP_CONCAT
public static final Expression.DyadicOperator OP_CONCAT
CONCAT
-
OP_MUL
public static final Expression.DyadicOperator OP_MUL
MUL
-
OP_DIV
public static final Expression.DyadicOperator OP_DIV
DIV
-
OP_MOD
public static final Expression.DyadicOperator OP_MOD
MOD
-
OP_NEG
public static final Expression.MonadicOperator OP_NEG
NEG
-
OP_COM
public static final Expression.MonadicOperator OP_COM
COM
-
OP_DISTINCT
public static final Expression.MonadicOperator OP_DISTINCT
DISTINCT
-
-
Constructor Detail
-
Expression
protected Expression()
Constructor.
-
Expression
protected Expression(Expression.MonadicOperator op, Expression operand)
Perform a functionop
onoperand
- Parameters:
op
- operatoroperand
- operand
-
Expression
protected Expression(Expression operand1, Expression.DyadicOperator op, Expression operand2)
Performs a function on two arguments. op(operand1,operand2) operand1 op operand2- Parameters:
operand1
- the first expressionop
- the operator between operandsoperand2
- the second expression
-
-
Method Detail
-
getParent
public Expression getParent()
Accessor for the parent expression where this expression is access from.- Returns:
- Parent expression
-
setLeft
public void setLeft(Expression expr)
-
setRight
public void setRight(Expression expr)
-
getOperator
public Expression.Operator getOperator()
The operator to be performed by this expression. See the OP_{name} final static properties of this class.- Returns:
- Operator
-
getLeft
public Expression getLeft()
Accessor for the left hand expression.- Returns:
- Left expression
-
getRight
public Expression getRight()
Accessor for the right hand expression.- Returns:
- Right expression
-
getSymbol
public Symbol getSymbol()
Accessor for the symbol for this expression (if set).- Returns:
- The symbol
-
setAlias
public void setAlias(String alias)
-
getAlias
public String getAlias()
-
evaluate
public Object evaluate(ExpressionEvaluator eval)
Method to evaluate this expression, using the passed evaluator.- Parameters:
eval
- Evaluator- Returns:
- The result
-
bind
public abstract Symbol bind(SymbolTable symtbl)
Method to bind the expression to the symbol table as appropriate.- Parameters:
symtbl
- Symbol table- Returns:
- The symbol for this expression
-
-