This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.script
class CompiledScript

java.lang.Object extended by javax.script.CompiledScript

Most common way to construct:

Compilable compilable = …;
String script = …;

CompiledScript compiledScript = compilable.compile(script);

Based on 6 examples


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.


Constructor Summary

          
 
Method Summary
 Object

          Executes the program stored in the CompiledScript object.
 Object
eval(Bindings bindings)

          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.
abstract Object

          Executes the program stored in this CompiledScript object.
abstract ScriptEngine

          Returns the ScriptEngine wbose compile method created this CompiledScript.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompiledScript

public CompiledScript()
Method Detail

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.

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 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.

getEngine

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

Returns:
The ScriptEngine that created this CompiledScript


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.