Java Reference
In-Depth Information
Table 12-1. The List of Java Classes/Interfaces to be Used with Nashorn Scripting Engine
Class/Interface
Description
NashornScriptEngine
Factory
This is a script engine factory implementation for the Nashorn
engine. You need to instantiate this class when you want to
create a Nashorn engine that uses Nashorn-specific options
and extensions.
NashornScriptEngine This is the script engine implementation class for the Nashorn
engine. You do not instantiate this class directly. Its instance
is obtained using the getScriptEngine() method of a
NashornScriptEngineFactory object.
NashornException
This is the base exception class for all exceptions thrown from
Nashorn scripts. When you use the Java Scripting API, your Java
code receives an instance of the ScriptException class that
will be a wrapper for the NashornException . An instance of the
NashornException may be thrown directly in Java code if you
access scripts directly from Java code such as by implementing
a Java interface in scripts and using that interface's instance
in Java code. This class contains many methods that give you
access to the details of the script error such as line number,
column number, the script's error object, and so on.
ClassFilter
ClassFilter is an interface. You can use its instance to
restrict the availability of some or all Java classes in the
Nashorn script. You will need to pass an instance of this
interface when instantiating a NashornScriptEngine using a
NashornScriptEngineFactory .
ScriptUtils
A utility class intended to be used in Nashorn scripts.
URLReader
Reads contents of a URL. It inherits from the java.io.Reader
class.
JSObject
An instance of this interface represents a Nashorn object in
Java code. If you want to pass a Java object to a Nashorn script
that should be treated as a Nashorn object, you need to pass
an instance of this interface. You can use the bracket notation
in Nashorn scripts to access and set properties of such Java
objects.
AbstractJSObject
This is an abstract class that implements the JSObject
interface.
ScriptObjectMirror
This is a mirror object that wraps a Nashorn script object. It
inherits from the AbstractJSObject class and implements the
Bindings interface. When Java code receives a Nashorn object
from scripts, the script object is wrapped in a ScriptObjectMirror
instance before being passed to the Java code.
 
Search WWH ::




Custom Search