Interface Script
- All Known Implementing Classes:
ExpressionImpl
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 TypeMethodDescriptioncallable
(JexlContext context) Creates a Callable from this script.callable
(JexlContext context, Object... args) Creates a Callable from this script.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 suppliedJexlContext
and a set of arguments corresponding to the parameters used during parsing.String[]
Gets this script local variables.String[]
Gets this script parameters.getText()
Returns the text of this Script.Gets this script variables.
-
Method Details
-
execute
Executes the script with the variables contained in the suppliedJexlContext
.- Parameters:
context
- A JexlContext containing variables.- Returns:
- The result of this script, usually the result of the last statement.
-
execute
Executes the script with the variables contained in the suppliedJexlContext
and a set of arguments corresponding to the parameters used during parsing.- Parameters:
context
- A JexlContext containing variables.args
- the arguments- Returns:
- The result of this script, usually the result of the last statement.
- Since:
- 2.1
-
getText
String getText()Returns the text of this Script.- Returns:
- The script to be executed.
-
getParameters
String[] getParameters()Gets this script parameters.- Returns:
- the parameters or null
- Since:
- 2.1
-
getLocalVariables
String[] getLocalVariables()Gets this script local variables.- 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.
- 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.
- Parameters:
context
- the context- Returns:
- the callable
- 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.
- Parameters:
context
- the contextargs
- the script arguments- Returns:
- the callable
- Since:
- 2.1
-