com.sun.javafx.api
Interface JavaFXScriptEngine

All Superinterfaces:
javax.script.Compilable, javax.script.Invocable, javax.script.ScriptEngine

public interface JavaFXScriptEngine
extends javax.script.ScriptEngine, javax.script.Compilable, javax.script.Invocable

The interface to the JavaFX Script scripting engine API. Its use is optional, as full script functionality is available via the javax.script API. In addition to the full script API, this interface defines versions of the eval and compile ScriptEngine methods which take a DiagnosticListener for accessing warning and error diagnostics reported during script parsing.


Field Summary
 
Fields inherited from interface javax.script.ScriptEngine
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME
 
Method Summary
 javax.script.CompiledScript compile(java.io.Reader script, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Compiles the script (source read from Reader) for later execution.
 javax.script.CompiledScript compile(java.lang.String script, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Compiles the script (source represented as a String) for later execution.
 java.lang.Object eval(java.io.Reader reader, javax.script.Bindings bindings, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Same as eval(String, Bindings) except that the source of the script is provided as a Reader.
 java.lang.Object eval(java.io.Reader script, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Same as eval(String) except that the source of the script is provided as a Reader.
 java.lang.Object eval(java.io.Reader reader, javax.script.ScriptContext context, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Same as eval(String, ScriptContext, DiagnosticListener) where the source of the script is read from a Reader.
 java.lang.Object eval(java.lang.String script, javax.script.Bindings bindings, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Executes the script using the Bindings argument as the ENGINE_SCOPE Bindings of the ScriptEngine during the script execution.
 java.lang.Object eval(java.lang.String script, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Executes the specified script.
 java.lang.Object eval(java.lang.String script, javax.script.ScriptContext context, javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
          Causes the immediate execution of the script whose source is the String passed as the first argument.
 
Methods inherited from interface javax.script.ScriptEngine
createBindings, eval, eval, eval, eval, eval, eval, get, getBindings, getContext, getFactory, put, setBindings, setContext
 
Methods inherited from interface javax.script.Compilable
compile, compile
 
Methods inherited from interface javax.script.Invocable
getInterface, getInterface, invokeFunction, invokeMethod
 

Method Detail

eval

java.lang.Object eval(java.lang.String script,
                      javax.script.ScriptContext context,
                      javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                      throws javax.script.ScriptException
Causes the immediate execution of the script whose source is the String passed as the first argument. The script may be reparsed or recompiled before execution. State left in the engine from previous executions, including variable values and compiled procedures may be visible during this execution.

Parameters:
script - The script to be executed by the script engine.
context - A ScriptContext exposing sets of attributes in different scopes. The meanings of the scopes ScriptContext.GLOBAL_SCOPE, and ScriptContext.ENGINE_SCOPE are defined in the JSR-223 specification.
listener - A DiagnosticListener to which warnings and errors found during script parsing are reported.
Returns:
The value returned from the execution of the script.
Throws:
ScriptException: - if an error occurs in script. ScriptEngines should create and throw ScriptException wrappers for checked Exceptions thrown by underlying scripting implementations.
NullPointerException: - if either argument is null.
javax.script.ScriptException

eval

java.lang.Object eval(java.io.Reader reader,
                      javax.script.ScriptContext context,
                      javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                      throws javax.script.ScriptException
Same as eval(String, ScriptContext, DiagnosticListener) where the source of the script is read from a Reader.

Parameters:
reader - The source of the script to be executed by the script engine.
context - A ScriptContext exposing sets of attributes in different scopes. The meanings of the scopes ScriptContext.GLOBAL_SCOPE, and ScriptContext.ENGINE_SCOPE are defined in the JSR-223 specification.
listener - A DiagnosticListener to which warnings and errors found during script parsing are reported.
Returns:
The value returned from the execution of the script.
Throws:
ScriptException: - if an error occurs in script. ScriptEngines should create and throw ScriptException wrappers for checked Exceptions thrown by underlying scripting implementations.
NullPointerException: - if either argument is null.
javax.script.ScriptException

eval

java.lang.Object eval(java.lang.String script,
                      javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                      throws javax.script.ScriptException
Executes the specified script. The default ScriptContext for the ScriptEngine is used.

Parameters:
script - The script to be executed by the script engine.
listener - A DiagnosticListener to which warnings and errors found during script parsing are reported.
Returns:
The value returned from the execution of the script.
Throws:
ScriptException: - if an error occurs in script. ScriptEngines should create and throw ScriptException wrappers for checked Exceptions thrown by underlying scripting implementations.
NullPointerException: - if either argument is null.
javax.script.ScriptException

eval

java.lang.Object eval(java.io.Reader script,
                      javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                      throws javax.script.ScriptException
Same as eval(String) except that the source of the script is provided as a Reader.

Parameters:
script - The script to be executed by the script engine.
listener - A DiagnosticListener to which warnings and errors found during script parsing are reported.
Returns:
The value returned from the execution of the script.
Throws:
ScriptException: - if an error occurs in script. ScriptEngines should create and throw ScriptException wrappers for checked Exceptions thrown by underlying scripting implementations.
NullPointerException: - if either argument is null.
javax.script.ScriptException

eval

java.lang.Object eval(java.lang.String script,
                      javax.script.Bindings bindings,
                      javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                      throws javax.script.ScriptException
Executes the script using the Bindings argument as the ENGINE_SCOPE Bindings of the ScriptEngine during the script execution. The Reader, Writer and non-ENGINE_SCOPE Bindings of the default ScriptContext are used. The ENGINE_SCOPE Bindings of the ScriptEngine is not changed, and its mappings are unaltered by the script execution.

Parameters:
script - The source for the script.
bindings - The Bindings of attributes to be used for script execution.
Returns:
The value returned by the script.
Throws:
ScriptException: - if an error occurrs in script.
NullPointerException: - if either argument is null.
javax.script.ScriptException

eval

java.lang.Object eval(java.io.Reader reader,
                      javax.script.Bindings bindings,
                      javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                      throws javax.script.ScriptException
Same as eval(String, Bindings) except that the source of the script is provided as a Reader.

Parameters:
reader - The source for the script.
bindings - The Bindings of attributes to be used for script execution.
Returns:
The value returned by the script.
Throws:
ScriptException: - if an error occurrs in script.
NullPointerException: - if either argument is null.
javax.script.ScriptException

compile

javax.script.CompiledScript compile(java.lang.String script,
                                    javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                                    throws javax.script.ScriptException
Compiles the script (source represented as a String) for later execution.

Parameters:
script - The source of the script, represented as a String.
listener - A DiagnosticListener to which warnings and errors found during script parsing are reported.
Returns:
An subclass of CompiledScript to be executed later using one of the eval methods of CompiledScript.
Throws:
ScriptException: - if compilation fails.
NullPointerException: - if the argument is null.
javax.script.ScriptException

compile

javax.script.CompiledScript compile(java.io.Reader script,
                                    javax.tools.DiagnosticListener<javax.tools.JavaFileObject> listener)
                                    throws javax.script.ScriptException
Compiles the script (source read from Reader) for later execution. Functionality is identical to compile(String) other than the way in which the source is passed.

Parameters:
script - The reader from which the script source is obtained.
listener - A DiagnosticListener to which warnings and errors found during script parsing are reported.
Returns:
An subclass of CompiledScript to be executed later using one of the eval methods of CompiledScript.
Throws:
ScriptException: - if compilation fails.
NullPointerException: - if the argument is null.
javax.script.ScriptException