public abstract class ExprAbstractScriptEngine
extends java.lang.Object
implements javax.script.ScriptEngine
eval
method.
eval(Reader)eval(String)
eval(String, Bindings)
eval(Reader, Bindings)
are implemented using the abstract methods
eval(Reader,ScriptContext) or
eval(String, ScriptContext)
with a ExprSimpleScriptContext.
A ExprSimpleScriptContext is used as the default ScriptContext
of the ExprAbstractScriptEngine..
| Modifier and Type | Field and Description |
|---|---|
protected javax.script.ScriptContext |
context
The default
ScriptContext of this ExprAbstractScriptEngine. |
| Constructor and Description |
|---|
ExprAbstractScriptEngine()
Creates a new instance of ExprAbstractScriptEngine using a
ExprSimpleScriptContext
as its default ScriptContext. |
ExprAbstractScriptEngine(javax.script.Bindings n)
Creates a new instance using the specified
Bindings as the
ENGINE_SCOPE Bindings in the protected context field. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
eval(java.io.Reader reader)
eval(Reader) calls the abstract
eval(Reader, ScriptContext) passing the value of the context
field. |
java.lang.Object |
eval(java.io.Reader reader,
javax.script.Bindings bindings)
eval(Reader, Bindings) calls the abstract
eval(Reader, ScriptContext) method, passing it a ScriptContext
whose Reader, Writers and Bindings for scopes other that ENGINE_SCOPE
are identical to those members of the protected context field. |
java.lang.Object |
eval(java.lang.String script)
Same as
eval(Reader) except that the abstract
eval(String, ScriptContext) is used. |
java.lang.Object |
eval(java.lang.String script,
javax.script.Bindings bindings)
Same as
eval(Reader, Bindings) except that the abstract
eval(String, ScriptContext) is used. |
java.lang.Object |
get(java.lang.String key)
Gets the value for the specified key in the
ENGINE_SCOPE of the
protected context field. |
javax.script.Bindings |
getBindings(int scope)
Returns the
Bindings with the specified scope value in
the protected context field. |
javax.script.ScriptContext |
getContext()
Returns the value of the protected
context field. |
protected javax.script.ScriptContext |
getScriptContext(javax.script.Bindings nn)
Returns a
ExprSimpleScriptContext. |
void |
put(java.lang.String key,
java.lang.Object value)
Sets the specified value with the specified key in the
ENGINE_SCOPE
Bindings of the protected context field. |
void |
setBindings(javax.script.Bindings bindings,
int scope)
Sets the
Bindings with the corresponding scope value in the
context field. |
void |
setContext(javax.script.ScriptContext ctxt)
Sets the value of the protected
context field to the specified
ScriptContext. |
protected javax.script.ScriptContext context
ScriptContext of this ExprAbstractScriptEngine.public ExprAbstractScriptEngine()
ExprSimpleScriptContext
as its default ScriptContext.public ExprAbstractScriptEngine(javax.script.Bindings n)
Bindings as the
ENGINE_SCOPE Bindings in the protected context field.n - The specified Bindings.java.lang.NullPointerException - if n is null.public void setContext(javax.script.ScriptContext ctxt)
context field to the specified
ScriptContext.setContext in interface javax.script.ScriptEnginectxt - The specified ScriptContext.java.lang.NullPointerException - if ctxt is null.public javax.script.ScriptContext getContext()
context field.getContext in interface javax.script.ScriptEnginecontext field.public javax.script.Bindings getBindings(int scope)
Bindings with the specified scope value in
the protected context field.getBindings in interface javax.script.ScriptEnginescope - The specified scopeBindings.java.lang.IllegalArgumentException - if the value of scope is
invalid for the type the protected context field.public void setBindings(javax.script.Bindings bindings,
int scope)
Bindings with the corresponding scope value in the
context field.setBindings in interface javax.script.ScriptEnginebindings - The specified Bindings.scope - The specified scope.java.lang.IllegalArgumentException - if the value of scope is
invalid for the type the context field.java.lang.NullPointerException - if the bindings is null and the scope is
ScriptContext.ENGINE_SCOPEpublic void put(java.lang.String key,
java.lang.Object value)
ENGINE_SCOPE
Bindings of the protected context field.put in interface javax.script.ScriptEnginekey - The specified key.value - The specified value.java.lang.NullPointerException - if key is null.java.lang.IllegalArgumentException - if key is empty.public java.lang.Object get(java.lang.String key)
ENGINE_SCOPE of the
protected context field.get in interface javax.script.ScriptEnginejava.lang.NullPointerException - if key is null.java.lang.IllegalArgumentException - if key is empty.public java.lang.Object eval(java.io.Reader reader,
javax.script.Bindings bindings)
throws javax.script.ScriptException
eval(Reader, Bindings) calls the abstract
eval(Reader, ScriptContext) method, passing it a ScriptContext
whose Reader, Writers and Bindings for scopes other that ENGINE_SCOPE
are identical to those members of the protected context field. The specified
Bindings is used instead of the ENGINE_SCOPE
Bindings of the context field.eval in interface javax.script.ScriptEnginereader - A Reader containing the source of the script.bindings - A Bindings to use for the ENGINE_SCOPE
while the script executes.eval(Reader, ScriptContext)javax.script.ScriptException - if an error occurs in script.java.lang.NullPointerException - if any of the parameters is null.public java.lang.Object eval(java.lang.String script,
javax.script.Bindings bindings)
throws javax.script.ScriptException
eval(Reader, Bindings) except that the abstract
eval(String, ScriptContext) is used.eval in interface javax.script.ScriptEnginescript - A String containing the source of the script.bindings - A Bindings to use as the ENGINE_SCOPE
while the script executes.eval(String, ScriptContext)javax.script.ScriptException - if an error occurs in script.java.lang.NullPointerException - if any of the parameters is null.public java.lang.Object eval(java.io.Reader reader)
throws javax.script.ScriptException
eval(Reader) calls the abstract
eval(Reader, ScriptContext) passing the value of the context
field.eval in interface javax.script.ScriptEnginereader - A Reader containing the source of the script.eval(Reader, ScriptContext)javax.script.ScriptException - if an error occurs in script.java.lang.NullPointerException - if any of the parameters is null.public java.lang.Object eval(java.lang.String script)
throws javax.script.ScriptException
eval(Reader) except that the abstract
eval(String, ScriptContext) is used.eval in interface javax.script.ScriptEnginescript - A String containing the source of the script.eval(String, ScriptContext)javax.script.ScriptException - if an error occurrs in script.java.lang.NullPointerException - if any of the parameters is null.protected javax.script.ScriptContext getScriptContext(javax.script.Bindings nn)
ExprSimpleScriptContext. The ExprSimpleScriptContext:
Bindings for its ENGINE_SCOPE
Bindings returned by the abstract getGlobalScope
method as its GLOBAL_SCOPE
ScriptContext of this
ScriptEngine
ExprSimpleScriptContext returned by this method is used to implement eval methods
using the abstract eval(Reader,Bindings) and eval(String,Bindings)
versions.nn - Bindings to use for the ENGINE_SCOPEExprSimpleScriptContext