Class Closure
java.lang.Object
org.apache.commons.jexl3.internal.Script
org.apache.commons.jexl3.internal.Closure
- All Implemented Interfaces:
JexlExpression,JexlScript
A Script closure.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.jexl3.internal.Script
Script.Callable -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FrameThe frame.protected final JexlOptionsThe options. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClosure(Interpreter theCaller, ASTJexlLambda lambda) Creates a closure.protectedCreates a curried version of a script. -
Method Summary
Modifier and TypeMethodDescriptioncallable(JexlContext context, Object... args) Creates a Callable from this script.booleanevaluate(JexlContext context) Evaluates the expression with the variables contained in the suppliedJexlContext.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 suppliedJexlContextand a set of arguments corresponding to the parameters used during parsing.String[]Gets this script unbound parameters.inthashCode()voidsetCaptured(int symbol, Object value) Sets the captured index of a given symbol, ie the target index of a parent captured symbol in this closure's frame.Methods inherited from class org.apache.commons.jexl3.internal.Script
callable, checkCacheVersion, createFrame, createInterpreter, createInterpreter, curry, getCapturedVariables, getEngine, getFeatures, getInfo, getLocalVariables, getParameters, getParsedText, getParsedText, getPragmas, getScript, getSourceText, getVariables, toString
-
Field Details
-
frame
The frame. -
options
The options.
-
-
Constructor Details
-
Closure
Creates a closure.- Parameters:
theCaller- the calling interpreterlambda- the lambda
-
Closure
Creates a curried version of a script.- Parameters:
base- the base scriptargs- the script arguments
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getUnboundParameters
Description copied from interface:JexlScriptGets this script unbound parameters.Parameters that haven't been bound by a previous call to curry().
- Specified by:
getUnboundParametersin interfaceJexlScript- Overrides:
getUnboundParametersin classScript- Returns:
- the parameters or null
-
setCaptured
Sets the captured index of a given symbol, ie the target index of a parent captured symbol in this closure's frame.This is meant to allow a locally defined function to "see" and call itself as a local (captured) variable; in other words, this allows recursive call of a function.
- Parameters:
symbol- the symbol index (in the caller of this closure)value- the value to set in the local frame
-
evaluate
Description copied from interface:JexlExpressionEvaluates the expression with the variables contained in the suppliedJexlContext.- Specified by:
evaluatein interfaceJexlExpression- Overrides:
evaluatein classScript- Parameters:
context- A JexlContext containing variables.- Returns:
- The result of this evaluation
-
execute
Description copied from interface:JexlScriptExecutes the script with the variables contained in the suppliedJexlContext.- Specified by:
executein interfaceJexlScript- Overrides:
executein classScript- Parameters:
context- A JexlContext containing variables.- Returns:
- The result of this script, usually the result of the last statement.
-
execute
Description copied from interface:JexlScriptExecutes the script with the variables contained in the suppliedJexlContextand a set of arguments corresponding to the parameters used during parsing.- Specified by:
executein interfaceJexlScript- Overrides:
executein classScript- Parameters:
context- A JexlContext containing variables.args- the arguments- Returns:
- The result of this script, usually the result of the last statement.
-
callable
Description copied from class:ScriptCreates 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.
- Specified by:
callablein interfaceJexlScript- Overrides:
callablein classScript- Parameters:
context- the contextargs- the script arguments- Returns:
- the callable
-