public class ExpressionImpl extends Object implements Expression, Script
JexlEngine,
and this is the default implementation of the Expression and
Script interface.| Modifier and Type | Field and Description |
|---|---|
protected String |
expression
Original expression stripped from leading & trailing spaces.
|
protected JexlEngine |
jexl
The engine for this expression.
|
protected ASTJexlScript |
script
The resulting AST we can interpret.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ExpressionImpl(JexlEngine engine,
String expr,
ASTJexlScript ref)
Do not let this be generally instantiated with a 'new'.
|
| Modifier and Type | Method and Description |
|---|---|
Callable<Object> |
callable(JexlContext context)
Creates a Callable from this script.
|
Callable<Object> |
callable(JexlContext context,
Object... args)
Creates a Callable from this script.
|
String |
dump()
Returns the JEXL expression by reconstructing it from the parsed tree.
|
Object |
evaluate(JexlContext context)
Evaluates the expression with the variables contained in the
supplied
JexlContext. |
Object |
execute(JexlContext context)
Executes the script with the variables contained in the
supplied
JexlContext. |
Object |
execute(JexlContext context,
Object... args)
Executes the script with the variables contained in the
supplied
JexlContext and a set of arguments corresponding to the
parameters used during parsing. |
String |
getExpression()
Returns the JEXL expression this Expression was created with.
|
String[] |
getLocalVariables()
Gets this script local variables.
|
String[] |
getParameters()
Gets this script parameters.
|
String |
getText()
Returns the text of this Script.
|
Set<List<String>> |
getVariables()
Gets this script variables.
|
String |
toString()
Provide a string representation of this expression.
|
protected final JexlEngine jexl
protected final String expression
protected final ASTJexlScript script
protected ExpressionImpl(JexlEngine engine, String expr, ASTJexlScript ref)
engine - the interpreter to evaluate the expressionexpr - the expression.ref - the parsed expression.public Object evaluate(JexlContext context)
JexlContext.evaluate in interface Expressioncontext - A JexlContext containing variables.public String dump()
dump in interface Expressionpublic String getExpression()
getExpression in interface Expressionpublic String toString()
public String getText()
public Object execute(JexlContext context)
JexlContext.public Object execute(JexlContext context, Object... args)
JexlContext and a set of arguments corresponding to the
parameters used during parsing.public String[] getParameters()
getParameters in interface Scriptpublic String[] getLocalVariables()
getLocalVariables in interface Scriptpublic Set<List<String>> getVariables()
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.
getVariables in interface Scriptpublic Callable<Object> callable(JexlContext context)
This allows to submit it to an executor pool and provides support for asynchronous calls.
The interpreter will handle interruption/cancellation gracefully if needed.
public Callable<Object> callable(JexlContext context, Object... args)
This allows to submit it to an executor pool and provides support for asynchronous calls.
The interpreter will handle interruption/cancellation gracefully if needed.
Copyright © 2020 Internet2. All rights reserved.