javax.script

Class CompiledScript


  • public abstract class CompiledScript
    extends Object
    Extended by classes that store results of compilations. State might be stored in the form of Java classes, Java class files or scripting language opcodes. The script may be executed repeatedly without reparsing.

    Each CompiledScript is associated with a ScriptEngine -- A call to an eval method of the CompiledScript causes the execution of the script by the ScriptEngine. Changes in the state of the ScriptEngine caused by execution of tne CompiledScript may visible during subsequent executions of scripts by the engine.
    Since:
    1.6
    • Constructor Detail

      • CompiledScript

        public CompiledScript()
    • Method Detail

      • eval

        public abstract Object eval(ScriptContext context)
                             throws ScriptException
        Executes the program stored in this CompiledScript object.
        Parameters:
        context - A ScriptContext that is used in the same way as the ScriptContext passed to the eval methods of ScriptEngine.
        Returns:
        The value returned by the script execution, if any. Should return null if no value is returned by the script execution.
        Throws:
        ScriptException - if an error occurs.
        NullPointerException - if context is null.
      • eval

        public Object eval(Bindings bindings)
                    throws ScriptException
        Executes the program stored in the CompiledScript object using the supplied Bindings of attributes as the ENGINE_SCOPE of the associated ScriptEngine during script execution. If bindings is null, then the effect of calling this method is same as that of eval(getEngine().getContext()).

        . The GLOBAL_SCOPE Bindings, Reader and Writer associated with the default ScriptContext of the associated ScriptEngine are used.

        Parameters:
        bindings - The bindings of attributes used for the ENGINE_SCOPE.
        Returns:
        The return value from the script execution
        Throws:
        ScriptException - if an error occurs.
      • eval

        public Object eval()
                    throws ScriptException
        Executes the program stored in the CompiledScript object. The default ScriptContext of the associated ScriptEngine is used. The effect of calling this method is same as that of eval(getEngine().getContext()).
        Returns:
        The return value from the script execution
        Throws:
        ScriptException - if an error occurs.
      • getEngine

        public abstract ScriptEngine getEngine()
        Returns the ScriptEngine whose compile method created this CompiledScript. The CompiledScript will execute in this engine.
        Returns:
        The ScriptEngine that created this CompiledScript

Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/script/compiledscript.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : https://docs.oracle.com

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut