Class JexlScriptEngine
- All Implemented Interfaces:
- Compilable,- ScriptEngine
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 SummaryNested ClassesModifier and TypeClassDescriptionclassImplements engine and engine context properties for use by JEXL scripts.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringReserved key for context (mandated by JSR-223).static final StringReserved key for JexlScriptObject.Fields inherited from class javax.script.AbstractScriptEnginecontextFields inherited from interface javax.script.ScriptEngineARGV, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor.JexlScriptEngine(ScriptEngineFactory scriptEngineFactory) Create a scripting engine using the supplied factory.
- 
Method SummaryModifier and TypeMethodDescriptioneval(Reader reader, ScriptContext context) eval(String script, ScriptContext context) static voidsetInstance(JexlEngine engine) Sets the shared instance used for the script engine.static voidsetPermissions(JexlPermissions permissions) Sets the permissions instance used to create the script engine.Methods inherited from class javax.script.AbstractScriptEngineeval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContext
- 
Field Details- 
CONTEXT_KEYReserved key for context (mandated by JSR-223).- See Also:
 
- 
JEXL_OBJECT_KEYReserved key for JexlScriptObject.- See Also:
 
 
- 
- 
Constructor Details- 
JexlScriptEnginepublic JexlScriptEngine()Default constructor.Only intended for use when not using a factory. Sets the factory to JexlScriptEngineFactory.
- 
JexlScriptEngineCreate a scripting engine using the supplied factory.- Parameters:
- scriptEngineFactory- the factory which created this instance.
- Throws:
- NullPointerException- if factory is null
 
 
- 
- 
Method Details- 
setInstanceSets the shared instance used for the script engine.This should be called early enough to have an effect, ie before any ScriptEngineManagerfeatures.To restore 3.2 script behavior: JexlScriptEngine.setInstance(new JexlBuilder() .cache(512) .logger(LogFactory.getLog(JexlScriptEngine.class)) .permissions(JexlPermissions.UNRESTRICTED) .create());- Parameters:
- engine- the JexlEngine instance to use
- Since:
- 3.3
 
- 
setPermissionsSets the permissions instance used to create the script engine.Calling this method will force engine instance re-creation. To restore 3.2 script behavior: JexlScriptEngine.setPermissions(JexlPermissions.UNRESTRICTED);- Parameters:
- permissions- the permissions instance to use or null to use the- JexlBuilderdefault
- Since:
- 3.3
 
- 
compile- Specified by:
- compilein interface- Compilable
- Throws:
- ScriptException
 
- 
compile- Specified by:
- compilein interface- Compilable
- Throws:
- ScriptException
 
- 
createBindings- Specified by:
- createBindingsin interface- ScriptEngine
 
- 
eval- Specified by:
- evalin interface- ScriptEngine
- Throws:
- ScriptException
 
- 
eval- Specified by:
- evalin interface- ScriptEngine
- Throws:
- ScriptException
 
- 
getFactory- Specified by:
- getFactoryin interface- ScriptEngine
 
 
-