Class ExpressionImpl
java.lang.Object
org.apache.commons.jexl2.ExpressionImpl
- All Implemented Interfaces:
Expression, Script
Instances of ExpressionImpl are created by the
JexlEngine,
and this is the default implementation of the Expression and
Script interface.- Since:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringOriginal expression stripped from leading & trailing spaces.protected final JexlEngineThe engine for this expression.protected final ASTJexlScriptThe resulting AST we can interpret. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedExpressionImpl(JexlEngine engine, String expr, ASTJexlScript ref) Do not let this be generally instantiated with a 'new'. -
Method Summary
Modifier and TypeMethodDescriptioncallable(JexlContext context) Creates a Callable from this script.callable(JexlContext context, Object... args) Creates a Callable from this script.dump()Returns the JEXL expression by reconstructing it from the parsed tree.evaluate(JexlContext context) Evaluates the expression with the variables contained in the suppliedJexlContext.execute(JexlContext context) Executes the script with the variables contained in the suppliedJexlContext.execute(JexlContext context, Object... args) Executes the script with the variables contained in the suppliedJexlContextand a set of arguments corresponding to the parameters used during parsing.Returns the JEXL expression this Expression was created with.String[]Gets this script local variables.String[]Gets this script parameters.getText()Returns the text of this Script.Gets this script variables.toString()Provide a string representation of this expression.
-
Field Details
-
jexl
The engine for this expression. -
expression
Original expression stripped from leading & trailing spaces. -
script
The resulting AST we can interpret.
-
-
Constructor Details
-
ExpressionImpl
Do not let this be generally instantiated with a 'new'.- Parameters:
engine- the interpreter to evaluate the expressionexpr- the expression.ref- the parsed expression.
-
-
Method Details
-
evaluate
Evaluates the expression with the variables contained in the suppliedJexlContext.- Specified by:
evaluatein interfaceExpression- Parameters:
context- A JexlContext containing variables.- Returns:
- The result of this evaluation
-
dump
Returns the JEXL expression by reconstructing it from the parsed tree.- Specified by:
dumpin interfaceExpression- Returns:
- the JEXL expression
-
getExpression
Returns the JEXL expression this Expression was created with.- Specified by:
getExpressionin interfaceExpression- Returns:
- The JEXL expression to be evaluated
-
toString
-
getText
-
execute
Executes the script with the variables contained in the suppliedJexlContext. -
execute
Executes the script with the variables contained in the suppliedJexlContextand a set of arguments corresponding to the parameters used during parsing. -
getParameters
Gets this script parameters.- Specified by:
getParametersin interfaceScript- Returns:
- the parameters or null
- Since:
- 2.1
-
getLocalVariables
Gets this script local variables.- Specified by:
getLocalVariablesin interfaceScript- Returns:
- the local variables or null
- Since:
- 2.1
-
getVariables
Gets this script variables.Note that since variables can be in an ant-ish form (ie foo.bar.quux), each variable is returned as a list of strings where each entry is a fragment of the variable ({"foo", "bar", "quux"} in the example.
- Specified by:
getVariablesin interfaceScript- Returns:
- the variables or null
- Since:
- 2.1
-
callable
Creates a Callable from this script.This allows to submit it to an executor pool and provides support for asynchronous calls.
The interpreter will handle interruption/cancellation gracefully if needed.
-
callable
Creates a Callable from this script.This allows to submit it to an executor pool and provides support for asynchronous calls.
The interpreter will handle interruption/cancellation gracefully if needed.
-