Package scriptella.driver.script
Class NashornBindingsParametersCallback
java.lang.Object
scriptella.driver.script.ParametersCallbackMap
scriptella.driver.script.BindingsParametersCallback
scriptella.driver.script.NashornBindingsParametersCallback
- All Implemented Interfaces:
Map<String,,Object> Bindings,ParametersCallback
Implementation of
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
- Author:
- Fyodor Kupolov
-
Nested Class Summary
-
Constructor Summary
ConstructorsConstructorDescriptionNashornBindingsParametersCallback(ParametersCallback parentParameters) NashornBindingsParametersCallback(ParametersCallback parentParameters, QueryCallback queryCallback) -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(Object key) getParameter(String name) Returns specified variable value.Sets local variable.Methods inherited from class scriptella.driver.script.ParametersCallbackMap
clear, containsValue, entrySet, isEmpty, isNextCalled, keySet, next, putAll, remove, setQueryCallback, size, valuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
-
Constructor Details
-
NashornBindingsParametersCallback
-
NashornBindingsParametersCallback
public NashornBindingsParametersCallback(ParametersCallback parentParameters, QueryCallback queryCallback)
-
-
Method Details
-
getParameter
Description copied from class:ParametersCallbackMapReturns specified variable value.The local variables set by
ParametersCallbackMap.put(String,Object)method take priority of variables in parentParameters object.- Specified by:
getParameterin interfaceParametersCallback- Overrides:
getParameterin classParametersCallbackMap- Parameters:
name- variable name- Returns:
- value of variable or null if variable not found.
-
get
Description copied from class:ParametersCallbackMap -
containsKey
- Specified by:
containsKeyin interfaceBindings- Specified by:
containsKeyin interfaceMap<String,Object> - Overrides:
containsKeyin classParametersCallbackMap
-
put
Description copied from class:ParametersCallbackMapSets local variable.
-