Class 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.Compilable
    Implementation of ScriptEngine for Strange Rhino, the modified Mozilla Rhino build used for Strange Eons scripts.
    • Field Summary

      • Fields inherited from class javax.script.AbstractScriptEngine

        context
      • Fields inherited from interface javax.script.ScriptEngine

        ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.script.CompiledScript compile​(java.io.Reader script)  
      javax.script.CompiledScript compile​(java.lang.String script)  
      javax.script.Bindings createBindings()
      Create a new bindings instance, used to define script values in a ScriptContext to make them available to a running script.
      java.lang.Object eval​(java.io.Reader reader, javax.script.ScriptContext scriptContext)  
      java.lang.Object eval​(java.lang.String script, javax.script.ScriptContext scriptContext)  
      javax.script.ScriptEngineFactory getFactory()  
      <T> T getInterface​(java.lang.Class<T> interfaceType)  
      <T> T getInterface​(java.lang.Object scriptObject, java.lang.Class<T> interfaceType)  
      java.lang.Object invokeFunction​(java.lang.String name, java.lang.Object... args)  
      java.lang.Object invokeMethod​(java.lang.Object thiz, java.lang.String name, java.lang.Object... args)  
      protected java.io.Reader preprocessScript​(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.
      • Methods inherited from class javax.script.AbstractScriptEngine

        eval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getFactory

        public javax.script.ScriptEngineFactory getFactory()
        Specified by:
        getFactory in interface javax.script.ScriptEngine
      • eval

        public java.lang.Object eval​(java.io.Reader reader,
                                     javax.script.ScriptContext scriptContext)
                              throws javax.script.ScriptException
        Specified by:
        eval in interface javax.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:
        eval in interface javax.script.ScriptEngine
        Throws:
        javax.script.ScriptException
      • createBindings

        public javax.script.Bindings createBindings()
        Create a new bindings instance, used to define script values in a ScriptContext to 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:
        createBindings in interface javax.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:
        invokeFunction in interface javax.script.Invocable
        Throws:
        javax.script.ScriptException
        java.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:
        invokeMethod in interface javax.script.Invocable
        Throws:
        javax.script.ScriptException
        java.lang.NoSuchMethodException
      • getInterface

        public <T> T getInterface​(java.lang.Class<T> interfaceType)
        Specified by:
        getInterface in interface javax.script.Invocable
      • getInterface

        public <T> T getInterface​(java.lang.Object scriptObject,
                                  java.lang.Class<T> interfaceType)
        Specified by:
        getInterface in interface javax.script.Invocable
      • compile

        public javax.script.CompiledScript compile​(java.lang.String script)
                                            throws javax.script.ScriptException
        Specified by:
        compile in interface javax.script.Compilable
        Throws:
        javax.script.ScriptException
      • compile

        public javax.script.CompiledScript compile​(java.io.Reader script)
                                            throws javax.script.ScriptException
        Specified by:
        compile in interface javax.script.Compilable
        Throws:
        javax.script.ScriptException
      • preprocessScript

        protected java.io.Reader preprocessScript​(java.lang.String fileName,
                                                  java.io.Reader reader)
                                           throws javax.script.ScriptException
        Subclasses 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 unknown
        reader - 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