Java Reference
In-Depth Information
The implementer of the
ScriptEngine
interface also provides an implementation of
the
ScriptEngineFactory
interface. A
ScriptEngineFactory
performs two tasks:
It creates instances of the script engine.
•
•
It provides information about the script engine such as engine
name, version, language, and so on.
The AbstractScriptEngine Class
The
AbstractScriptEngine
class is an abstract class. It provides a partial implementation
for the
ScriptEngine
interface. You will not use this class directly unless you are
implementing a script engine.
The ScriptEngineManager Class
The
ScriptEngineManager
class provides a discovery and instantiation mechanism
for script engines. It also maintains a mapping of key-value pairs as an instance of the
Bindings
interface storing state that is shared by all script engines that it creates.
The Compilable Interface and the CompiledScript Class
The
Compilable
interface may optionally be implemented by a script engine that allows
compiling scripts for their repeated execution without recompilation.
The
CompiledScript
class is an abstract class. It is extended by the providers of a
script engine. It stores a script in a compiled form, which may be executed repeatedly
without recompilation. Note that using a
ScriptEngine
to execute a script repeatedly
causes the script to recompile every time, thus slowing down the performance.
A script engine is not required to support script compilation. It must implement the
Compilable
interface if it supports script compilation.
The Invocable Interface
The
Invocable
interface may optionally be implemented by a script engine that may
allow invoking procedures, functions, and methods in scripts that have been compiled
previously.
The Bindings Interface and the SimpleBindings Class
An instance of a class that implements the
Bindings
interface is a mapping of
key-value pairs with a restriction that a key must be non-null, non-empty
String
. It
extends the
java.util.Map
interface. The
SimpleBindings
class is an implementation of
the
Bindings
interface.
Search WWH ::
Custom Search