Modifier and Type | Method and Description |
---|---|
static ProxyObject |
fromMap(Map<String,Object> values)
Creates a proxy backed by a
Map . |
Object |
getMember(String key)
Returns the value of the member.
|
Object |
getMemberKeys()
Returns an array of member keys.
|
boolean |
hasMember(String key)
Returns
true if the proxy object contains a member with the given key, or else
false . |
void |
putMember(String key,
Value value)
Sets the value associated with a member.
|
default boolean |
removeMember(String key)
Removes a member key and its value.
|
Object getMember(String key)
UnsupportedOperationException
- if the operation is unsupportedObject getMemberKeys()
Context.asValue(Object)
and taking host access into
consideration. Otherwise, an IllegalStateException
is thrown. If one of the return
values of the array is not a String
then a ClassCastException
is thrown.
Examples for valid return values are:
null
for no member keys
ProxyArray
that returns String
values for each array element
List
with exclusively String elements (HostAccess
must allowListAccess)
String[]
(HostAccess
must allowArrayAccess)
ProxyObject.getMemberKeys()
method must return
true
for ProxyObject.hasMember(String)
.ProxyObject.hasMember(String)
,
Context.asValue(Object)
boolean hasMember(String key)
true
if the proxy object contains a member with the given key, or else
false
. While not required ever member key which returns true
for
ProxyObject.hasMember(String)
should be returned by ProxyObject.getMemberKeys()
to allow guest
members to list member keys.ProxyObject.getMemberKeys()
void putMember(String key, Value value)
exist
then a new member is defined. If the definition of new members is not supported then
an UnsupportedOperationException
is thrown.UnsupportedOperationException
- if the operation is unsupporteddefault boolean removeMember(String key)
UnsupportedOperationException
is thrown.true
when the member was removed, false
when the member
didn't exist.UnsupportedOperationException
- if the operation is unsupported