Class JavaCompiledScript


  • public class JavaCompiledScript
    extends javax.script.CompiledScript
    The compiled Java script created by a JavaScriptEngine.
    • Field Detail

      • compiledClass

        private final java.lang.Class<?> compiledClass
      • compiledInstance

        private final java.lang.Object compiledInstance
    • Constructor Detail

      • JavaCompiledScript

        JavaCompiledScript​(JavaScriptEngine engine,
                           java.lang.Class<?> compiledClass,
                           java.lang.Object compiledInstance,
                           ExecutionStrategy executionStrategy)
        Construct a JavaCompiledScript.
        Parameters:
        engine - the JavaScriptEngine that compiled this script
        compiledClass - the compiled Class
        compiledInstance - the instance of the compiled Class or null if no instance was created and only static methods will be called by the the ExecutionStrategy.
        executionStrategy - the ExecutionStrategy
    • Method Detail

      • getCompiledClass

        public java.lang.Class<?> getCompiledClass()
        Returns the compiled Class.
        Returns:
        the compiled Class.
      • getCompiledInstance

        public java.lang.Object getCompiledInstance()
        Returns the instance of the compiled Class.
        Returns:
        the instance of the compiled Class or null if no instance was created and only static methods will be called by the the ExecutionStrategy.
      • getInstanceClass

        @Deprecated
        public java.lang.Class<?> getInstanceClass()
        Deprecated.
        in release 1.1.0 this method was deprecated, use getCompiledClass() instead.
        Returns the compiled Class.
        Returns:
        the compiled Class.
      • getInstance

        @Deprecated
        public java.lang.Object getInstance()
        Deprecated.
        in release 1.1.0 this method was deprecated, use getCompiledInstance() instead.
        Returns the instance of the compiled Class.
        Returns:
        the instance of the compiled Class or null if no instance was created and only static methods will be called by the the ExecutionStrategy.
      • getEngine

        public javax.script.ScriptEngine getEngine()
        Specified by:
        getEngine in class javax.script.CompiledScript
      • eval

        public java.lang.Object eval​(javax.script.ScriptContext context)
                              throws javax.script.ScriptException
        Specified by:
        eval in class javax.script.CompiledScript
        Throws:
        javax.script.ScriptException
      • pushVariables

        private void pushVariables​(javax.script.Bindings globalBindings,
                                   javax.script.Bindings engineBindings)
                            throws javax.script.ScriptException
        Throws:
        javax.script.ScriptException
      • pullVariables

        private void pullVariables​(javax.script.Bindings globalBindings,
                                   javax.script.Bindings engineBindings)
                            throws javax.script.ScriptException
        Throws:
        javax.script.ScriptException
      • setBindingsValue

        private void setBindingsValue​(javax.script.Bindings globalBindings,
                                      javax.script.Bindings engineBindings,
                                      java.lang.String name,
                                      java.lang.Object value)
      • mergeBindings

        private java.util.Map<java.lang.String,​java.lang.Object> mergeBindings​(javax.script.Bindings... bindingsToMerge)