public class ExplangScriptEngine extends Object implements ScriptEngine, Invocable
| Modifier and Type | Field and Description |
|---|---|
protected Compiler |
comp |
protected ScriptContext |
defScriptContext |
protected ScriptEngineFactory |
factory |
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME| Modifier | Constructor and Description |
|---|---|
protected |
ExplangScriptEngine() |
protected |
ExplangScriptEngine(Bindings bindings) |
protected |
ExplangScriptEngine(ScriptEngineFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
Bindings |
createBindings() |
Object |
eval(Reader reader) |
Object |
eval(Reader reader,
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. |
Object |
eval(Reader reader,
ScriptContext context) |
Object |
eval(String script) |
Object |
eval(String script,
Bindings bindings) |
Object |
eval(String script,
ScriptContext context) |
Object |
get(String key)
Gets the value for the specified key in the
ENGINE_SCOPE of the protected
context field. |
Bindings |
getBindings(int scope)
Returns the
Bindings with the specified scope value in the protected context
field. |
ScriptContext |
getContext() |
ScriptEngineFactory |
getFactory() |
<T> T |
getInterface(Class<T> clasz) |
<T> T |
getInterface(Object thiz,
Class<T> clasz) |
protected ScriptContext |
getScriptContext(Bindings nn)
Returns a
SimpleScriptContext. |
Object |
invokeFunction(String name,
Object... args) |
Object |
invokeMethod(Object thiz,
String name,
Object... args) |
protected Compiler.ICtx |
makeCtx(ScriptContext sc) |
void |
put(String key,
Object value) |
void |
setBindings(Bindings bindings,
int scope) |
void |
setContext(ScriptContext ctxt)
Sets the value of the protected
context field to the specified ScriptContext
. |
protected final ScriptEngineFactory factory
protected ScriptContext defScriptContext
protected Compiler comp
protected ExplangScriptEngine(Bindings bindings)
protected ExplangScriptEngine()
protected ExplangScriptEngine(ScriptEngineFactory factory)
protected Compiler.ICtx makeCtx(ScriptContext sc)
public Object eval(String script, ScriptContext context) throws ScriptException
eval in interface ScriptEngineScriptExceptionpublic Object eval(Reader reader, ScriptContext context) throws ScriptException
eval in interface ScriptEngineScriptExceptionpublic Object eval(String script) throws ScriptException
eval in interface ScriptEngineScriptExceptionpublic Object eval(Reader reader) throws ScriptException
eval in interface ScriptEngineScriptExceptionpublic Object eval(String script, Bindings bindings) throws ScriptException
eval in interface ScriptEngineScriptExceptionpublic Object eval(Reader reader, Bindings bindings) throws 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 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)ScriptException - if an error occurs in script.NullPointerException - if any of the parameters is null.public void put(String key, Object value)
put in interface ScriptEnginepublic Object get(String key)
ENGINE_SCOPE of the protected
context field.get in interface ScriptEngineNullPointerException - if key is null.IllegalArgumentException - if key is empty.public Bindings getBindings(int scope)
Bindings with the specified scope value in the protected context
field.getBindings in interface ScriptEnginescope - The specified scopeBindings.IllegalArgumentException - if the value of scope is invalid for the type the protected
context field.public void setBindings(Bindings bindings, int scope)
setBindings in interface ScriptEnginepublic Bindings createBindings()
createBindings in interface ScriptEnginepublic ScriptContext getContext()
getContext in interface ScriptEnginepublic void setContext(ScriptContext ctxt)
context field to the specified ScriptContext
.setContext in interface ScriptEnginectxt - The specified ScriptContext.NullPointerException - if ctxt is null.public ScriptEngineFactory getFactory()
getFactory in interface ScriptEngineprotected ScriptContext getScriptContext(Bindings nn)
SimpleScriptContext. The SimpleScriptContext: Bindings for its ENGINE_SCOPE
Bindings returned by the abstract getGlobalScope
method as its GLOBAL_SCOPE
ScriptContext of this
ScriptEngine
SimpleScriptContext 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_SCOPESimpleScriptContextpublic Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException
invokeMethod in interface InvocableScriptExceptionNoSuchMethodExceptionpublic Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException
invokeFunction in interface InvocableScriptExceptionNoSuchMethodExceptionpublic <T> T getInterface(Class<T> clasz)
getInterface in interface Invocablepublic <T> T getInterface(Object thiz, Class<T> clasz)
getInterface in interface InvocableCopyright © 2022. All rights reserved.