Interface Expression
-
- All Known Implementing Classes:
AddExpression
,AndExpression
,ArgumentExpression
,ArrayIndexExpression
,BinaryOperatorExpression
,BooleanExpression
,BWAndExpression
,BWComplementExpression
,BWOrExpression
,BWSignedLeftShiftExpression
,BWSignedRightShiftExpression
,BWUnsignedRightShiftExpression
,BWXorExpression
,ConditionTernaryExpression
,ContainsExpression
,DecimalExpression
,DivideExpression
,EndsWithExpression
,EQExpression
,FunctionExpression
,GTEExpression
,GTExpression
,IdentifierExpression
,LTEExpression
,LTExpression
,MaxExpression
,MinExpression
,MinusExpression
,MulExpression
,MultiplyExpression
,NEExpression
,NotExpression
,NullExpression
,NumericExpression
,OrExpression
,ParanthesisExpression
,PlusExpression
,PropertyExpression
,RemainderExpression
,ResultTernaryExpression
,StartsWithExpression
,StringExpression
,SubtractExpression
,SumExpression
,UnaryOperatorExpression
,UnaryPropertyExpression
public interface Expression
This class represents the executable structure of an expression. Parser parse the expression and break it into individual expression tokens. This token list is feed to compiler for creating the executable structure of expressions using objects of this class. Compiler create relevant expression object (of this class) for every token and creates a relative expression chain as operands or operators. Final outcome of Compiler is a single top level expression which contains all expression in hierarchy. So the final expression can be an atomic Expression class or an Expression having a large tree of children expressions with it. TODO improve tostring to represent actual expression
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
accept(ExpressionVisitor visitor)
Implements visitor pattern.Type
getReturnType()
Gets the return type of the expression.ValueObject
getValue()
Executes and returns the value of this expression.void
initialize(ExpressionContext expressionContext, Object parameters, boolean validate)
This is used to initialize the expression.void
uninitialize(ExpressionContext expressionContext)
This is used to un-initialize the expression, so that expression can be reused.
-
-
-
Method Detail
-
getValue
ValueObject getValue() throws ExpressionEngineException
Executes and returns the value of this expression. If expression is not at node level, it will further evaluate its related expression which may represents operands or operators and return the final outcome.- Returns:
- the value of expression (after expression evaluation)
- Throws:
ExpressionEngineException
- if there is any problem during execution
-
getReturnType
Type getReturnType() throws ExpressionEngineException
Gets the return type of the expression.- Returns:
- the type of expression
- Throws:
ExpressionEngineException
- If there is any problem during execution
-
initialize
void initialize(ExpressionContext expressionContext, Object parameters, boolean validate) throws ExpressionEngineException
This is used to initialize the expression.- Parameters:
expressionContext
- contextual information, may help in initializationparameters
- for example, sub expressions and identifiers- Throws:
ExpressionEngineException
- if there is any problem during execution
-
uninitialize
void uninitialize(ExpressionContext expressionContext)
This is used to un-initialize the expression, so that expression can be reused.- Parameters:
expressionContext
- contextual information, may help in un-initialization
-
accept
void accept(ExpressionVisitor visitor)
Implements visitor pattern.- Parameters:
visitor
- a visitor object that this expression must visit when accept is called.
-
-