| 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()
Removes all of the mappings from this map (optional operation).
|
boolean |
containsKey(Object key)
Returns true if this map contains a mapping for the specified
key.
|
boolean |
containsValue(Object value)
Returns true if this map maps one or more keys to the
specified value.
|
boolean |
delete(Object key)
Delete a property from this object.
|
Set<Map.Entry<String,Object>> |
entrySet()
Returns a
Set view of the mappings contained in this map. |
boolean |
equals(Object other)
Compares the argument to the receiver, and answers true
if they represent the same object using a class
specific comparison.
|
Object |
eval(String s)
Evaluate a JavaScript expression.
|
ScriptObjectMirror |
freeze()
ECMA 15.2.39 - freeze implementation.
|
Object |
get(Object key)
Returns the value to which this map maps the specified key.
|
String |
getClassName()
ECMA [[Class]] property
|
Object |
getDefaultValue(Class<?> hint)
Implements this object's
[[DefaultValue]] method. |
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()
Answers an integer hash code for the receiver.
|
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()
Returns true if this map contains no key-value mappings.
|
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 instance)
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)
Set a named value.
|
void |
putAll(Map<? extends String,? extends Object> map)
Adds all the mappings in a given
Map to this Bindings. |
Object |
remove(Object key)
Removes the mapping for this key from this map if it is present
(optional operation).
|
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()
Returns the number of key-value mappings in this map.
|
<T> T |
to(Class<T> type)
Utility to convert this script object to the given type.
|
double |
toNumber()
Deprecated.
|
String |
toString()
Answers a string containing a concise, human-readable
description of the receiver.
|
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.
|
static Object |
wrapAsJSONCompatible(Object obj,
Object homeGlobal)
Make a script object mirror on given object if needed.
|
getDefaultValue, isInstanceOfclone, finalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAllpublic boolean equals(Object other)
java.lang.Objectpublic int hashCode()
java.lang.Objecttrue when passed to
.equals must answer the same value for this
method.public String toString()
java.lang.Objectpublic Object call(Object thiz, Object... args)
JSObjectcall in interface JSObjectcall in class AbstractJSObjectthiz - 'this' object to be passed to the function. This may be null.args - arguments to methodpublic Object newObject(Object... args)
JSObjectnewObject in interface JSObjectnewObject in class AbstractJSObjectargs - arguments to methodpublic Object eval(String s)
JSObjecteval in interface JSObjecteval in class AbstractJSObjects - JavaScript expression to evaluatepublic Object callMember(String functionName, Object... args)
functionName - function nameargs - argumentspublic Object getMember(String name)
JSObjectgetMember in interface JSObjectgetMember in class AbstractJSObjectname - of memberpublic Object getSlot(int index)
JSObjectgetSlot in interface JSObjectgetSlot in class AbstractJSObjectindex - index slot to retrievepublic boolean hasMember(String name)
JSObjecthasMember in interface JSObjecthasMember in class AbstractJSObjectname - name of memberpublic boolean hasSlot(int slot)
JSObjecthasSlot in interface JSObjecthasSlot in class AbstractJSObjectslot - index to checkpublic void removeMember(String name)
JSObjectremoveMember in interface JSObjectremoveMember in class AbstractJSObjectname - name of the memberpublic void setMember(String name, Object value)
JSObjectsetMember in interface JSObjectsetMember in class AbstractJSObjectname - name of the membervalue - value of the memberpublic void setSlot(int index,
Object value)
JSObjectsetSlot in interface JSObjectsetSlot in class AbstractJSObjectindex - index of the member slotvalue - value of the memberpublic void setIndexedPropertiesToExternalArrayData(ByteBuffer buf)
buf - external buffer - should be a nio ByteBufferpublic boolean isInstance(Object instance)
JSObjectisInstance in interface JSObjectisInstance in class AbstractJSObjectinstance - instance to checkpublic String getClassName()
JSObjectgetClassName in interface JSObjectgetClassName in class AbstractJSObjectpublic boolean isFunction()
JSObjectisFunction in interface JSObjectisFunction in class AbstractJSObjectpublic boolean isStrictFunction()
JSObjectisStrictFunction in interface JSObjectisStrictFunction in class AbstractJSObjectpublic boolean isArray()
JSObjectisArray in interface JSObjectisArray in class AbstractJSObjectpublic void clear()
java.util.Mappublic boolean containsKey(Object key)
javax.script.BindingscontainsKey in interface Map<String,Object>containsKey in interface Bindingskey - key whose presence in this map is to be tested.public boolean containsValue(Object value)
java.util.MapcontainsValue in interface Map<String,Object>value - value whose presence in this map is to be testedpublic Set<Map.Entry<String,Object>> entrySet()
java.util.MapSet view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation, or through the
setValue operation on a map entry returned by the
iterator) the results of the iteration are undefined. The set
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Set.remove, removeAll, retainAll and
clear operations. It does not support the
add or addAll operations.public Object get(Object key)
javax.script.BindingsMore formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)
public boolean isEmpty()
java.util.Mappublic Set<String> keySet()
JSObjectpublic Object put(String key, Object value)
javax.script.Bindingsput in interface Map<String,Object>put in interface Bindingskey - The name associated with the value.value - The value associated with the name.public void putAll(Map<? extends String,? extends Object> map)
javax.script.BindingsMap to this Bindings.public Object remove(Object key)
javax.script.Bindings(key==null ? k==null : key.equals(k)), that mapping
is removed. (The map can contain at most one such mapping.)
Returns the value to which the map previously associated the key, or null if the map contained no mapping for this key. (A null return can also indicate that the map previously associated null with the specified key if the implementation supports null values.) The map will not contain a mapping for the specified key once the call returns.
public boolean delete(Object key)
key - the property to be deletedpublic int size()
java.util.Mappublic Collection<Object> values()
JSObjectpublic 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.public static Object wrapAsJSONCompatible(Object obj, Object homeGlobal)
List interface if obj is a JavaScript Array object;
this is compatible with Java JSON libraries expectations. Arrays retrieved through its
properties (transitively) will also implement the list interface.obj - object to be wrapped/convertedhomeGlobal - global to which this object belongs.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 object@Deprecated public double toNumber()
AbstractJSObjecttoNumber in interface JSObjecttoNumber in class AbstractJSObjectpublic Object getDefaultValue(Class<?> hint)
AbstractJSObject[[DefaultValue]] method. The default implementation follows ECMAScript 5.1
section 8.6.2 but subclasses are free to provide their own implementations.getDefaultValue in class AbstractJSObjecthint - the type hint. Should be either null, Number.class or String.class.
Copyright © 2014, 2025, Oracle and/or its affiliates. All rights reserved.
DRAFT internal-b00