Class SEScriptEngine
- java.lang.Object
-
- javax.script.AbstractScriptEngine
-
- ca.cgjennings.apps.arkham.plugins.engine.SEScriptEngine
-
- All Implemented Interfaces:
javax.script.Compilable,javax.script.Invocable,javax.script.ScriptEngine
public final class SEScriptEngine extends javax.script.AbstractScriptEngine implements javax.script.Invocable, javax.script.CompilableImplementation ofScriptEnginefor Strange Rhino, the modified Mozilla Rhino build used for Strange Eons scripts.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.script.CompiledScriptcompile(java.io.Reader script)javax.script.CompiledScriptcompile(java.lang.String script)javax.script.BindingscreateBindings()Create a new bindings instance, used to define script values in aScriptContextto make them available to a running script.java.lang.Objecteval(java.io.Reader reader, javax.script.ScriptContext scriptContext)java.lang.Objecteval(java.lang.String script, javax.script.ScriptContext scriptContext)javax.script.ScriptEngineFactorygetFactory()<T> TgetInterface(java.lang.Class<T> interfaceType)<T> TgetInterface(java.lang.Object scriptObject, java.lang.Class<T> interfaceType)java.lang.ObjectinvokeFunction(java.lang.String name, java.lang.Object... args)java.lang.ObjectinvokeMethod(java.lang.Object thiz, java.lang.String name, java.lang.Object... args)protected java.io.ReaderpreprocessScript(java.lang.String fileName, java.io.Reader reader)Subclasses may override this to construct a pipeline that can access and modify the script source before it is evaluated.
-
-
-
Method Detail
-
getFactory
public javax.script.ScriptEngineFactory getFactory()
- Specified by:
getFactoryin interfacejavax.script.ScriptEngine
-
eval
public java.lang.Object eval(java.io.Reader reader, javax.script.ScriptContext scriptContext) throws javax.script.ScriptException- Specified by:
evalin interfacejavax.script.ScriptEngine- Throws:
javax.script.ScriptException
-
eval
public java.lang.Object eval(java.lang.String script, javax.script.ScriptContext scriptContext) throws javax.script.ScriptException- Specified by:
evalin interfacejavax.script.ScriptEngine- Throws:
javax.script.ScriptException
-
createBindings
public javax.script.Bindings createBindings()
Create a new bindings instance, used to define script values in aScriptContextto make them available to a running script. This will return bindings that can correctly handle keys that link to setting values and translated strings.- Specified by:
createBindingsin interfacejavax.script.ScriptEngine- Returns:
- a map of values that can be placed in a script's scope
-
invokeFunction
public java.lang.Object invokeFunction(java.lang.String name, java.lang.Object... args) throws javax.script.ScriptException, java.lang.NoSuchMethodException- Specified by:
invokeFunctionin interfacejavax.script.Invocable- Throws:
javax.script.ScriptExceptionjava.lang.NoSuchMethodException
-
invokeMethod
public java.lang.Object invokeMethod(java.lang.Object thiz, java.lang.String name, java.lang.Object... args) throws javax.script.ScriptException, java.lang.NoSuchMethodException- Specified by:
invokeMethodin interfacejavax.script.Invocable- Throws:
javax.script.ScriptExceptionjava.lang.NoSuchMethodException
-
getInterface
public <T> T getInterface(java.lang.Class<T> interfaceType)
- Specified by:
getInterfacein interfacejavax.script.Invocable
-
getInterface
public <T> T getInterface(java.lang.Object scriptObject, java.lang.Class<T> interfaceType)- Specified by:
getInterfacein interfacejavax.script.Invocable
-
compile
public javax.script.CompiledScript compile(java.lang.String script) throws javax.script.ScriptException- Specified by:
compilein interfacejavax.script.Compilable- Throws:
javax.script.ScriptException
-
compile
public javax.script.CompiledScript compile(java.io.Reader script) throws javax.script.ScriptException- Specified by:
compilein interfacejavax.script.Compilable- Throws:
javax.script.ScriptException
-
preprocessScript
protected java.io.Reader preprocessScript(java.lang.String fileName, java.io.Reader reader) throws javax.script.ScriptExceptionSubclasses may override this to construct a pipeline that can access and modify the script source before it is evaluated.- Parameters:
fileName- the script file name; will be a fallback name if unknownreader- a non-null reader that will produce the source text- Returns:
- a reader that will produce the modified text, or the original reader
- Throws:
javax.script.ScriptException- if an exception occurs while modifying the text
-
-