|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.jexl2.ExpressionImpl
public class ExpressionImpl
Instances of ExpressionImpl are created by the JexlEngine
,
and this is the default implementation of the Expression
and
Script
interface.
Field Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
protected |
ExpressionImpl(JexlEngine engine,
String expr,
ASTJexlScript ref)
Do not let this be generally instantiated with a 'new'. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final JexlEngine jexl
protected final String expression
protected final ASTJexlScript script
Constructor Detail |
---|
protected ExpressionImpl(JexlEngine engine, String expr, ASTJexlScript ref)
engine
- the interpreter to evaluate the expressionexpr
- the expression.ref
- the parsed expression.Method Detail |
---|
public Object evaluate(JexlContext context)
JexlContext
.
evaluate
in interface Expression
context
- A JexlContext containing variables.
public String dump()
dump
in interface Expression
public String getExpression()
getExpression
in interface Expression
public String toString()
toString
in class Object
public String getText()
getText
in interface Script
public Object execute(JexlContext context)
JexlContext
.
execute
in interface Script
context
- A JexlContext containing variables.
public Object execute(JexlContext context, Object... args)
JexlContext
and a set of arguments corresponding to the
parameters used during parsing.
execute
in interface Script
context
- A JexlContext containing variables.args
- the arguments
public String[] getParameters()
getParameters
in interface Script
public String[] getLocalVariables()
getLocalVariables
in interface Script
public 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 Script
public 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.
callable
in interface Script
context
- the context
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.
callable
in interface Script
context
- the contextargs
- the script arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |