### javax.script

# Class CompiledScript

- `java.lang.Object`

- `javax.script.CompiledScript`

`public abstract class CompiledScript`
`extends java.lang.Object`

ComplieScript interface is an abstraction for the intermediate code produced by the compilation and contains methods which allow the re-execution of the intermediate code retained.

Authors:
  Nandika Jayawardana <nandika@opensource.lk>
  Sanka Samaranayake <sanka@opensource.lk>

## Constructor Summary

`CompiledScript()`
  The basic constructor.

## Method Summary

`java.lang.Object`

`eval(Bindings namespace)`
  Re-evaluates the pre-compiled script using the specified namespace as the SCRIPT_SCOPE and using ENGINE_SCOPE, GLOBAL_SCOPE of the associated ScriptEngine.

`java.lang.Object`

`eval(ScriptContext context)`
  Re-evaluates the recompiled script using the specified ScriptContext.

`ScriptEngine`

`getEngine()`
  Retrieves a reference to the ScriptEngine whose methods created this CompiledScript object.

### Methods inherited from class java.lang.Object

`equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Constructor Details

### CompiledScript

    public CompiledScript()

> The basic constructor. Object is special, because it has no superclass, so there is no call to super().

## Method Details

### eval

    public java.lang.Object eval(Bindings namespace)
                throws ScriptException

> Re-evaluates the pre-compiled script using the specified namespace as the SCRIPT_SCOPE and using ENGINE_SCOPE, GLOBAL_SCOPE of the associated ScriptEngine.

> Parameters:
>   `namespace` - the namespace to be used as the SCRIPT_SCOPE

> Returns:
>   resultant object after the re-evaluation

> Throws:
>   `ScriptException` - if the re-evaluation fails due to any reason

### eval

    public java.lang.Object eval(ScriptContext context)
                throws ScriptException

> Re-evaluates the recompiled script using the specified ScriptContext.

> Parameters:
>   `context` - A ScriptContext to be used in the re-evalution of the script

> Returns:
>   resultant object after the re-evaluation

> Throws:
>   `ScriptException` - if the re-evaluation fails due to any reason

### getEngine

    public ScriptEngine getEngine()

> Retrieves a reference to the ScriptEngine whose methods created this CompiledScript object.

> Returns:
>   the ScriptEngine which created this CompiledScript object