public class JSBindings extends Object implements Bindings
Constructor and Description |
---|
JSBindings(Context context,
Bindings bindings)
Initialises the internal Bindings delegate and SCXML context.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Delegates to the wrapped Bindings
clear method. |
boolean |
containsKey(Object key)
Returns
true if the wrapped Bindings delegate
or SCXML context contains a variable identified by
key . |
boolean |
containsValue(Object value)
Returns
true if the wrapped Bindings delegate
or SCXML context contains value . |
Set<Map.Entry<String,Object>> |
entrySet()
Returns a union of the wrapped Bindings entry set and the
SCXML context entry set.
|
Object |
get(Object key)
Returns the value from the wrapped Bindings delegate
or SCXML context contains identified by
key . |
protected Bindings |
getGlobalBindings()
Return the global bindings (i.e. nashorn Global instance) set by the script engine if existing.
|
protected boolean |
hasGlobalBindings()
Return true if a global bindings (i.e. nashorn Global instance) was ever set by the script engine.
|
boolean |
isEmpty()
Returns a
true if both the Bindings delegate and
the SCXML context maps are empty. |
Set<String> |
keySet()
Returns a union of the wrapped Bindings entry set and the
SCXML context entry set.
|
Object |
put(String name,
Object value)
The following delegation model is used to set values:
Delegates to
Context.set(String,Object) if the
Context contains the key (name), else
Delegates to the wrapped Bindings.put(String, Object)
if the Bindings contains the key (name), else
Delegates to Context.setLocal(String, Object)
|
void |
putAll(Map<? extends String,? extends Object> toMerge)
Delegates to the wrapped Bindings
putAll method i.e. does
not store variables in the SCXML context. |
Object |
remove(Object key)
Removes the object from the wrapped Bindings instance or the contained
SCXML context.
|
int |
size()
Returns the combined size of the wrapped Bindings entry set and the
SCXML context entry set.
|
Collection<Object> |
values()
Returns a union of the wrapped Bindings value list and the
SCXML context value list.
|
public JSBindings(Context context, Bindings bindings)
context
- SCXML Context to use for script variables.bindings
- Javascript engine bindings for Javascript variables.IllegalArgumentException
- Thrown if either context
or bindings
is null
.public boolean containsKey(Object key)
true
if the wrapped Bindings delegate
or SCXML context contains a variable identified by
key
.containsKey
in interface Map<String,Object>
containsKey
in interface Bindings
public Set<String> keySet()
NOTE: doesn't seem to be invoked ever. Not thread-safe.
public int size()
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
public boolean containsValue(Object value)
true
if the wrapped Bindings delegate
or SCXML context contains value
.
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
containsValue
in interface Map<String,Object>
public Set<Map.Entry<String,Object>> entrySet()
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
public Collection<Object> values()
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
public boolean isEmpty()
true
if both the Bindings delegate and
the SCXML context maps are empty.
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
public Object get(Object key)
key
.public Object put(String name, Object value)
Context.set(String,Object)
if the
Context
contains the key (name), elseBindings.put(String, Object)
if the Bindings
contains the key (name), elseContext.setLocal(String, Object)
public void putAll(Map<? extends String,? extends Object> toMerge)
putAll
method i.e. does
not store variables in the SCXML context.
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
public Object remove(Object key)
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
public void clear()
clear
method. Does not clear
the SCXML context.
NOTE: doesn't seem to be invoked ever so not sure if it works in context. Not thread-safe.
protected boolean hasGlobalBindings()
Note: because the global binding can be set by the script engine when evaluating a script, we should check or retrieve the global binding whenever needed instead of initialization time.
protected Bindings getGlobalBindings()
Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.