Class JexlScriptEngine
java.lang.Object
javax.script.AbstractScriptEngine
org.apache.commons.jexl2.scripting.JexlScriptEngine
- All Implemented Interfaces:
Compilable, ScriptEngine
Implements the Jexl ScriptEngine for JSF-223.
This implementation gives access to both ENGINE_SCOPE and GLOBAL_SCOPE bindings. When a JEXL script accesses a variable for read or write, this implementation checks first ENGINE and then GLOBAL scope. The first one found is used. If no variable is found, and the JEXL script is writing to a variable, it will be stored in the ENGINE scope.
The implementation also creates the "JEXL" script object as an instance of the
class JexlScriptEngine.JexlScriptObject for access to utility methods and variables.
- Since:
- 2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassImplements engine and engine context properties for use by JEXL scripts. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReserved key for context (mandated by JSR-223).static final StringReserved key for JexlScriptObject.Fields inherited from class AbstractScriptEngine
contextFields inherited from interface ScriptEngine
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.JexlScriptEngine(ScriptEngineFactory factory) Create a scripting engine using the supplied factory. -
Method Summary
Modifier and TypeMethodDescriptioneval(Reader reader, ScriptContext context) eval(String script, ScriptContext context) Methods inherited from class AbstractScriptEngine
eval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContext
-
Field Details
-
CONTEXT_KEY
-
JEXL_OBJECT_KEY
-
-
Constructor Details
-
JexlScriptEngine
public JexlScriptEngine()Default constructor.Only intended for use when not using a factory. Sets the factory to
JexlScriptEngineFactory. -
JexlScriptEngine
Create a scripting engine using the supplied factory.- Parameters:
factory- the factory which created this instance.- Throws:
NullPointerException- if factory is null
-
-
Method Details
-
createBindings
- Specified by:
createBindingsin interfaceScriptEngine
-
eval
- Specified by:
evalin interfaceScriptEngine- Throws:
ScriptException
-
eval
- Specified by:
evalin interfaceScriptEngine- Throws:
ScriptException
-
getFactory
- Specified by:
getFactoryin interfaceScriptEngine
-
compile
- Specified by:
compilein interfaceCompilable- Throws:
ScriptException
-
compile
- Specified by:
compilein interfaceCompilable- Throws:
ScriptException
-