Java Reference
In-Depth Information
Table 12-3. The List of Methods Declared in the JSObject Interface with Their Descriptions
Method
Description
Object call(Object thiz,
Object... args)
Calls this object as a function. You will use this
method when the JSObject contains the reference
of a Nashorn function or a method. The argument
thiz is used as the value of this in the function
invocation. The arguments in args are passed as
the arguments to the called function. This method
works in Java the same way as func.apply(thiz,
args) works in Nashorn scripts.
Object eval(String script)
Evaluates the specified script.
String getClassName()
Returns the ECMAScript class name of the object.
This is not the same as the class name in Java.
Object getMember(String name) Returns the value of the named property of the
script object.
Object getSlot(int index)
Returns the value of the indexed property of the
script object.
boolean hasMember(String
name)
Returns true if the script object has a named
property; returns false otherwise.
boolean hasSlot(int index)
Returns true if the script object has an indexed
property; returns false otherwise.
boolean isArray()
Returns true if the script object is an array object;
returns false otherwise.
boolean isFunction()
Returns true if the script object is a function object;
returns false otherwise.
boolean isInstance(Object
instance)
Returns true if the specified instance is an instance
of this object; returns false otherwise.
boolean isInstanceOf(Object
clazz)
Returns true if this object is an instance of the
specified clazz ; returns false otherwise.
boolean isStrictFunction()
Returns true if this object is a strict function; returns
false otherwise.
Set<String> keySet()
Returns the names of all properties of this object as
a set of strings.
Object newObject
(Object... args)
The object on which this method is invoked
should be a constructor function object. Call
this constructor to create a new object. This
is equivalent to new func(arg1, arg2...) in
Nashorn scripts.
( continued )
Search WWH ::




Custom Search