Java Reference
In-Depth Information
The Java scripting API also let you compile a script once, store it in the script engine,
and execute the script multiple times. It is supported through the
Compilable
interface.
A script engine supporting script compilation needs to implement the
Compilable
interface. You need to call the
compile()
method of the
Compilable
interface to compile
a script. The
compile()
method returns an instance of the
CompiledScript
whose
eval()
method is called to execute the script.
Note that implementing the
Invocable
and
Compilable
interfaces by a script engine
is optional. Before invoking procedures and compiling scripts, you need to check if the
script engine is an instance of these interfaces, cast the engine to these types, and, then,
execute methods of these interfaces.
Search WWH ::
Custom Search