Top Description Methods
org.apache.commons.jexl2

public Interface Script

Known Direct Implementers
org.apache.commons.jexl2.ExpressionImpl
Imports
java.util.List, .Set, java.util.concurrent.Callable

A JEXL Script.

A script is some valid JEXL syntax to be executed with a given set of JexlContext variables.

A script is a group of statements, separated by semicolons.

The statements can be blocks (curly braces containing code), Control statements such as if and while as well as expressions and assignment statements.

Since
1.1

Method Summary

Modifier and TypeMethod and Description
public Callable<Object>

Returns:

the callable
callable
(JexlContext
the context
context
)

Creates a Callable from this script.

public Callable<Object>

Returns:

the callable
callable
(JexlContext
the context
context
,
Object...
the script arguments
args
)

Creates a Callable from this script.

public Object

Returns:

The result of this script, usually the result of the last statement.
execute
(JexlContext
A JexlContext containing variables.
context
)

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

public Object

Returns:

The result of this script, usually the result of the last statement.
execute
(JexlContext
A JexlContext containing variables.
context
,
Object...
the arguments
args
)

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[]

Returns:

the local variables or null
getLocalVariables
()

Gets this script local variables.

public String[]

Returns:

the parameters or null
getParameters
()

Gets this script parameters.

public String

Returns:

The script to be executed.
getText
()

Returns the text of this Script.

public Set<List<String>>

Returns:

the variables or null
getVariables
()

Gets this script variables.

Method Detail

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

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)

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
executeback to summary
public Object execute(JexlContext context)

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)

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
getLocalVariablesback to summary
public String[] getLocalVariables()

Gets this script local variables.

Returns:String[]

the local variables or null

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

Gets this script parameters.

Returns:String[]

the parameters or null

Since
2.1
getTextback to summary
public String getText()

Returns the text of this Script.

Returns:String

The script to be executed.

getVariablesback to summary
public Set<List<String>> 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