public class Closure extends Script
Script.Callable, Script.Curried| Modifier and Type | Field and Description |
|---|---|
protected Scope.Frame |
frame
The frame.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Closure(Interpreter theCaller,
ASTJexlLambda lambda)
Creates a closure.
|
| Modifier and Type | Method and Description |
|---|---|
Script.Callable |
callable(JexlContext context,
Object... args)
Creates a Callable from this script.
|
boolean |
equals(Object obj) |
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 |
getParsedText()
Recreates the source text of this expression from the internal syntactic tree.
|
int |
hashCode() |
void |
setHoisted(int symbol,
Object value)
Sets the hoisted index of a given symbol, ie the target index of a parent hoisted symbol in this closure's frame.
|
String |
toString() |
callable, checkCacheVersion, createFrame, createInterpreter, curry, getEngine, getLocalVariables, getParameters, getParsedText, getPragmas, getSourceText, getVariablesprotected final Scope.Frame frame
protected Closure(Interpreter theCaller, ASTJexlLambda lambda)
theCaller - the calling interpreterlambda - the lambdapublic String getParsedText()
ScriptgetParsedText in interface JexlExpressiongetParsedText in interface JexlScriptgetParsedText in class Scriptpublic void setHoisted(int symbol,
Object value)
This is meant to allow a locally defined function to "see" and call itself as a local (hoisted) variable; in other words, this allows recursive call of a function.
symbol - the symbol index (in the caller of this closure)value - the value to set in the local framepublic Object evaluate(JexlContext context)
ScriptJexlContext.evaluate in interface JexlExpressionevaluate in class Scriptcontext - A JexlContext containing variables.public Object execute(JexlContext context)
ScriptJexlContext.execute in interface JexlScriptexecute in class Scriptcontext - A JexlContext containing variables.public Object execute(JexlContext context, Object... args)
ScriptJexlContext and a set of arguments corresponding to the
parameters used during parsing.execute in interface JexlScriptexecute in class Scriptcontext - A JexlContext containing variables.args - the argumentspublic Script.Callable callable(JexlContext context, Object... args)
ScriptThis 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 JexlScriptcallable in class Scriptcontext - the contextargs - the script argumentsCopyright © 2001–2016 The Apache Software Foundation. All rights reserved.