public class NashornBindingsParametersCallback extends BindingsParametersCallback
Bindings
for Java 8 JavaScript engine "Nashorn".
See Nashorn engine notes
for reasoning. In essence, Nashorn expects Bindings
to be an instance of
jdk.nashorn.api.scripting.ScriptObjectMirror
, otherwise it puts "nashorn.global" variable inside and use it
to store all variables. This makes the interface pretty unusable and requires some tricks implemented below
Constructor and Description |
---|
NashornBindingsParametersCallback(ParametersCallback parentParameters) |
NashornBindingsParametersCallback(ParametersCallback parentParameters,
QueryCallback queryCallback) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.Object key) |
java.lang.Object |
get(java.lang.Object key)
|
java.lang.Object |
getParameter(java.lang.String name)
Returns specified variable value.
|
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
Sets local variable.
|
clear, containsValue, entrySet, isEmpty, isNextCalled, keySet, next, putAll, remove, setQueryCallback, size, values
public NashornBindingsParametersCallback(ParametersCallback parentParameters)
public NashornBindingsParametersCallback(ParametersCallback parentParameters, QueryCallback queryCallback)
public java.lang.Object getParameter(java.lang.String name)
ParametersCallbackMap
The local variables set by ParametersCallbackMap.put(String,Object)
method
take priority of variables in parentParameters object.
getParameter
in interface ParametersCallback
getParameter
in class ParametersCallbackMap
name
- variable namepublic java.lang.Object get(java.lang.Object key)
ParametersCallbackMap
get
in interface java.util.Map<java.lang.String,java.lang.Object>
get
in interface javax.script.Bindings
get
in class ParametersCallbackMap
key
- variable name.public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.lang.Object>
containsKey
in interface javax.script.Bindings
containsKey
in class ParametersCallbackMap
public java.lang.Object put(java.lang.String key, java.lang.Object value)
ParametersCallbackMap
put
in interface java.util.Map<java.lang.String,java.lang.Object>
put
in interface javax.script.Bindings
put
in class ParametersCallbackMap
key
- variable name.value
- variable value.Copyright © Copyright 2006-2019 The Scriptella Project Team.