Modifier and Type | Method and Description |
---|---|
Object |
call(Object thiz,
Object... args)
Call this object as a JavaScript function.
|
Object |
callMember(String functionName,
Object... args)
Call member function
|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
boolean |
delete(Object key)
Delete a property from this object.
|
Set<Map.Entry<String,Object>> |
entrySet() |
boolean |
equals(Object other) |
Object |
eval(String s)
Evaluate a JavaScript expression.
|
ScriptObjectMirror |
freeze()
ECMA 15.2.39 - freeze implementation.
|
Object |
get(Object key) |
String |
getClassName()
ECMA [[Class]] property
|
Object |
getMember(String name)
Retrieves a named member of this JavaScript object.
|
String[] |
getOwnKeys(boolean all)
return an array of own property keys associated with the object.
|
Object |
getOwnPropertyDescriptor(String key)
ECMA 8.12.1 [[GetOwnProperty]] (P)
|
Object |
getProto()
Return the __proto__ of this object.
|
Object |
getSlot(int index)
Retrieves an indexed member of this JavaScript object.
|
int |
hashCode() |
boolean |
hasMember(String name)
Does this object have a named member?
|
boolean |
hasSlot(int slot)
Does this object have a indexed property?
|
static boolean |
identical(Object obj1,
Object obj2)
Are the given objects mirrors to same underlying object?
|
boolean |
isArray()
Is this an array object?
|
boolean |
isEmpty() |
boolean |
isExtensible()
Check if this script object is extensible
|
boolean |
isFrozen()
Check whether this script object is frozen
|
boolean |
isFunction()
Is this a function object?
|
boolean |
isInstance(Object obj)
Checking whether the given object is an instance of 'this' object.
|
boolean |
isSealed()
Check whether this script object is sealed
|
boolean |
isStrictFunction()
Is this a 'use strict' function object?
|
static boolean |
isUndefined(Object obj)
Utility to check if given object is ECMAScript undefined value
|
Set<String> |
keySet()
Returns the set of all property names of this object.
|
Object |
newObject(Object... args)
Call this 'constructor' JavaScript function to create a new object.
|
ScriptObjectMirror |
preventExtensions()
Flag this script object as non extensible
|
Object |
put(String key,
Object value) |
void |
putAll(Map<? extends String,? extends Object> map) |
Object |
remove(Object key) |
void |
removeMember(String name)
Remove a named member from this JavaScript object
|
ScriptObjectMirror |
seal()
ECMAScript 15.2.3.8 - seal implementation
|
void |
setIndexedPropertiesToExternalArrayData(ByteBuffer buf)
Nashorn extension: setIndexedPropertiesToExternalArrayData.
|
void |
setMember(String name,
Object value)
Set a named member in this JavaScript object
|
void |
setProto(Object proto)
Set the __proto__ of this object.
|
void |
setSlot(int index,
Object value)
Set an indexed member in this JavaScript object
|
int |
size() |
<T> T |
to(Class<T> type)
Utilitity to convert this script object to the given type.
|
double |
toNumber()
Returns this object's numeric value.
|
String |
toString() |
static Object |
unwrap(Object obj,
Object homeGlobal)
Unwrap a script object mirror if needed.
|
static Object[] |
unwrapArray(Object[] args,
Object homeGlobal)
Unwrap an array of script object mirrors if needed.
|
Collection<Object> |
values()
Returns the set of all property values of this object.
|
static Object |
wrap(Object obj,
Object homeGlobal)
Make a script object mirror on given object if needed.
|
static Object[] |
wrapArray(Object[] args,
Object homeGlobal)
Wrap an array of object to script object mirrors if needed.
|
isInstanceOf
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public boolean equals(Object other)
public int hashCode()
public Object call(Object thiz, Object... args)
AbstractJSObject
call
in interface JSObject
call
in class AbstractJSObject
thiz
- 'this' object to be passed to the functionargs
- arguments to methodpublic Object newObject(Object... args)
AbstractJSObject
newObject
in interface JSObject
newObject
in class AbstractJSObject
args
- arguments to methodpublic Object eval(String s)
AbstractJSObject
eval
in interface JSObject
eval
in class AbstractJSObject
s
- JavaScript expression to evaluatepublic Object callMember(String functionName, Object... args)
functionName
- function nameargs
- argumentspublic Object getMember(String name)
AbstractJSObject
getMember
in interface JSObject
getMember
in class AbstractJSObject
name
- of memberpublic Object getSlot(int index)
AbstractJSObject
getSlot
in interface JSObject
getSlot
in class AbstractJSObject
index
- index slot to retrievepublic boolean hasMember(String name)
AbstractJSObject
hasMember
in interface JSObject
hasMember
in class AbstractJSObject
name
- name of memberpublic boolean hasSlot(int slot)
AbstractJSObject
hasSlot
in interface JSObject
hasSlot
in class AbstractJSObject
slot
- index to checkpublic void removeMember(String name)
AbstractJSObject
removeMember
in interface JSObject
removeMember
in class AbstractJSObject
name
- name of the memberpublic void setMember(String name, Object value)
AbstractJSObject
setMember
in interface JSObject
setMember
in class AbstractJSObject
name
- name of the membervalue
- value of the memberpublic void setSlot(int index, Object value)
AbstractJSObject
setSlot
in interface JSObject
setSlot
in class AbstractJSObject
index
- index of the member slotvalue
- value of the memberpublic void setIndexedPropertiesToExternalArrayData(ByteBuffer buf)
buf
- external buffer - should be a nio ByteBufferpublic boolean isInstance(Object obj)
AbstractJSObject
isInstance
in interface JSObject
isInstance
in class AbstractJSObject
obj
- instace to checkpublic String getClassName()
AbstractJSObject
getClassName
in interface JSObject
getClassName
in class AbstractJSObject
public boolean isFunction()
AbstractJSObject
isFunction
in interface JSObject
isFunction
in class AbstractJSObject
public boolean isStrictFunction()
AbstractJSObject
isStrictFunction
in interface JSObject
isStrictFunction
in class AbstractJSObject
public boolean isArray()
AbstractJSObject
isArray
in interface JSObject
isArray
in class AbstractJSObject
public boolean containsKey(Object key)
containsKey
in interface Map<String,Object>
containsKey
in interface Bindings
public boolean containsValue(Object value)
containsValue
in interface Map<String,Object>
public Set<String> keySet()
AbstractJSObject
public boolean delete(Object key)
key
- the property to be deletedpublic Collection<Object> values()
AbstractJSObject
public Object getProto()
public void setProto(Object proto)
proto
- new proto for this objectpublic Object getOwnPropertyDescriptor(String key)
key
- property keypublic String[] getOwnKeys(boolean all)
all
- True if to include non-enumerable keys.public ScriptObjectMirror preventExtensions()
public boolean isExtensible()
public ScriptObjectMirror seal()
public boolean isSealed()
public ScriptObjectMirror freeze()
public boolean isFrozen()
public static boolean isUndefined(Object obj)
obj
- object to checkpublic <T> T to(Class<T> type)
T
- destination type to convert totype
- destination type to convert topublic static Object wrap(Object obj, Object homeGlobal)
obj
- object to be wrapped/convertedhomeGlobal
- global to which this object belongs. Not used for ConsStrings.public static Object unwrap(Object obj, Object homeGlobal)
obj
- object to be unwrappedhomeGlobal
- global to which this object belongspublic static Object[] wrapArray(Object[] args, Object homeGlobal)
args
- array to be unwrappedhomeGlobal
- global to which this object belongspublic static Object[] unwrapArray(Object[] args, Object homeGlobal)
args
- array to be unwrappedhomeGlobal
- global to which this object belongspublic static boolean identical(Object obj1, Object obj2)
obj1
- first objectobj2
- second objectpublic double toNumber()
AbstractJSObject
toNumber
in interface JSObject
toNumber
in class AbstractJSObject