Top Description Fields Constructors Methods
org.apache.commons.jexl2

public Class ExpressionImpl

extends Object
implements Expression, Script
Class Inheritance
All Implemented Interfaces
org.apache.commons.jexl2.Script, org.apache.commons.jexl2.Expression
Imports
java.util.List, .Set, java.util.concurrent.Callable, org.apache.commons.jexl2.parser.ASTJexlScript

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

Modifier and TypeField and Description
protected final String
expression

Original expression stripped from leading & trailing spaces.

protected final JexlEngine
jexl

The engine for this expression.

protected final ASTJexlScript
script

The resulting AST we can interpret.

Constructor Summary

AccessConstructor and Description
protected
ExpressionImpl(JexlEngine
the interpreter to evaluate the expression
engine
,
String
the expression.
expr
,
ASTJexlScript
the parsed expression.
ref
)

Do not let this be generally instantiated with a 'new'.

Method Summary

Modifier and TypeMethod and Description
public Callable<Object>
callable(JexlContext
the context
context
)

Implements org.apache.commons.jexl2.Script.callable.

Creates a Callable from this script.
public Callable<Object>
callable(JexlContext
the context
context
,
Object...
the script arguments
args
)

Implements org.apache.commons.jexl2.Script.callable.

Creates a Callable from this script.
public String
dump()

Implements org.apache.commons.jexl2.Expression.dump.

Returns the JEXL expression by reconstructing it from the parsed tree.
public Object
evaluate(JexlContext
A JexlContext containing variables.
context
)

Implements org.apache.commons.jexl2.Expression.evaluate.

Evaluates the expression with the variables contained in the supplied JexlContext.
public Object
execute(JexlContext
A JexlContext containing variables.
context
)

Implements org.apache.commons.jexl2.Script.execute.

Executes the script with the variables contained in the supplied JexlContext.
public Object
execute(JexlContext
A JexlContext containing variables.
context
,
Object...
the arguments
args
)

Implements org.apache.commons.jexl2.Script.execute.

Executes the script with the variables contained in the supplied JexlContext and a set of arguments corresponding to the parameters used during parsing.
public String
getExpression()

Implements org.apache.commons.jexl2.Expression.getExpression.

Returns the JEXL expression this Expression was created with.
public String[]
getLocalVariables()

Implements org.apache.commons.jexl2.Script.getLocalVariables.

Gets this script local variables.
public String[]
getParameters()

Implements org.apache.commons.jexl2.Script.getParameters.

Gets this script parameters.
public String
getText()

Implements org.apache.commons.jexl2.Script.getText.

Returns the text of this Script.
public Set<List<String>>
getVariables()

Implements org.apache.commons.jexl2.Script.getVariables.

Gets this script variables.
public String

Returns:

the expression or blank if it's null.
toString
()

Overrides java.lang.Object.toString.

Provide a string representation of this expression.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

expressionback to summary
protected final String expression

Original expression stripped from leading & trailing spaces.

jexlback to summary
protected final JexlEngine jexl

The engine for this expression.

scriptback to summary
protected final ASTJexlScript script

The resulting AST we can interpret.

Constructor Detail

ExpressionImplback to summary
protected ExpressionImpl(JexlEngine engine, String expr, ASTJexlScript ref)

Do not let this be generally instantiated with a 'new'.

Parameters
engine:JexlEngine

the interpreter to evaluate the expression

expr:String

the expression.

ref:ASTJexlScript

the parsed expression.

Method Detail

callableback to summary
public Callable<Object> callable(JexlContext context)

Implements org.apache.commons.jexl2.Script.callable.

Doc from org.apache.commons.jexl2.Script.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.

Parameters
context:JexlContext

the context

Returns:Callable<Object>

the callable

Since
2.1
callableback to summary
public Callable<Object> callable(JexlContext context, Object... args)

Implements org.apache.commons.jexl2.Script.callable.

Doc from org.apache.commons.jexl2.Script.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.

Parameters
context:JexlContext

the context

args:Object[]

the script arguments

Returns:Callable<Object>

the callable

Since
2.1
dumpback to summary
public String dump()

Implements org.apache.commons.jexl2.Expression.dump.

Doc from org.apache.commons.jexl2.Expression.dump.

Returns the JEXL expression by reconstructing it from the parsed tree.

Returns:String

the JEXL expression

evaluateback to summary
public Object evaluate(JexlContext context)

Implements org.apache.commons.jexl2.Expression.evaluate.

Doc from org.apache.commons.jexl2.Expression.evaluate.

Evaluates the expression with the variables contained in the supplied JexlContext.

Parameters
context:JexlContext

A JexlContext containing variables.

Returns:Object

The result of this evaluation

executeback to summary
public Object execute(JexlContext context)

Implements org.apache.commons.jexl2.Script.execute.

Doc from org.apache.commons.jexl2.Script.execute.

Executes the script with the variables contained in the supplied JexlContext.

Parameters
context:JexlContext

A JexlContext containing variables.

Returns:Object

The result of this script, usually the result of the last statement.

executeback to summary
public Object execute(JexlContext context, Object... args)

Implements org.apache.commons.jexl2.Script.execute.

Doc from org.apache.commons.jexl2.Script.execute.

Executes the script with the variables contained in the supplied JexlContext and a set of arguments corresponding to the parameters used during parsing.

Parameters
context:JexlContext

A JexlContext containing variables.

args:Object[]

the arguments

Returns:Object

The result of this script, usually the result of the last statement.

Since
2.1
getExpressionback to summary
public String getExpression()

Implements org.apache.commons.jexl2.Expression.getExpression.

Doc from org.apache.commons.jexl2.Expression.getExpression.

Returns the JEXL expression this Expression was created with.

Returns:String

The JEXL expression to be evaluated

getLocalVariablesback to summary
public String[] getLocalVariables()

Implements org.apache.commons.jexl2.Script.getLocalVariables.

Doc from org.apache.commons.jexl2.Script.getLocalVariables.

Gets this script local variables.

Returns:String[]

the local variables or null

Since
2.1
getParametersback to summary
public String[] getParameters()

Implements org.apache.commons.jexl2.Script.getParameters.

Doc from org.apache.commons.jexl2.Script.getParameters.

Gets this script parameters.

Returns:String[]

the parameters or null

Since
2.1
getTextback to summary
public String getText()

Implements org.apache.commons.jexl2.Script.getText.

Doc from org.apache.commons.jexl2.Script.getText.

Returns the text of this Script.

Returns:String

The script to be executed.

getVariablesback to summary
public Set<List<String>> getVariables()

Implements org.apache.commons.jexl2.Script.getVariables.

Doc from org.apache.commons.jexl2.Script.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.

Returns:Set<List<String>>

the variables or null

Since
2.1
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Provide a string representation of this expression.

Returns:String

the expression or blank if it's null.

Annotations
@Override