Class ScriptableWrappedMap
java.lang.Object
org.springframework.extensions.webscripts.ScriptableWrappedMap
- All Implemented Interfaces:
Map,org.mozilla.javascript.Scriptable,org.mozilla.javascript.Wrapper,ScriptableMap
public class ScriptableWrappedMap
extends Object
implements ScriptableMap, org.mozilla.javascript.Wrapper
Implementation of a Scriptable Map. This is the best choice where you want values to be
persisted directly to an underlying map supplied on construction. The class automatically
wraps/unwraps JS objects as they enter/leave the underlying map via the Scriptable interface
methods - objects are untouched if accessed via the usual Map interface methods.
Access should be by string key only - not integer index - unless you are sure the wrapped
map will maintain insertion order of the elements.
- Author:
- Kevin Roast
-
Nested Class Summary
-
Field Summary
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionScriptableWrappedMap(Map map) ConstructScriptableWrappedMap(org.mozilla.javascript.Scriptable scope, Map map) Construct -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) voiddelete(int index) voidentrySet()get(int index, org.mozilla.javascript.Scriptable start) getDefaultValue(Class hint) Object[]getIds()org.mozilla.javascript.Scriptableorg.mozilla.javascript.Scriptablebooleanhas(int index, org.mozilla.javascript.Scriptable start) booleanbooleanhasInstance(org.mozilla.javascript.Scriptable value) booleanisEmpty()keySet()voidvoidvoidvoidsetParentScope(org.mozilla.javascript.Scriptable parent) voidsetPrototype(org.mozilla.javascript.Scriptable prototype) intsize()toString()unwrap()values()static ScriptableWrappedMapConstructionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ScriptableWrappedMap
Construct- Parameters:
map- Map
-
ScriptableWrappedMap
Construct- Parameters:
scope- Scriptablemap- Map
-
-
Method Details
-
wrap
public static ScriptableWrappedMap wrap(org.mozilla.javascript.Scriptable scope, Map<Object, Object> map) Construction- Parameters:
scope- Scriptablemap- Map<Object, Object>- Returns:
- scriptable wrapped map
-
unwrap
- Specified by:
unwrapin interfaceorg.mozilla.javascript.Wrapper
-
getClassName
- Specified by:
getClassNamein interfaceorg.mozilla.javascript.Scriptable
-
get
- Specified by:
getin interfaceorg.mozilla.javascript.Scriptable
-
get
- Specified by:
getin interfaceorg.mozilla.javascript.Scriptable
-
has
- Specified by:
hasin interfaceorg.mozilla.javascript.Scriptable
-
has
public boolean has(int index, org.mozilla.javascript.Scriptable start) - Specified by:
hasin interfaceorg.mozilla.javascript.Scriptable
-
put
- Specified by:
putin interfaceorg.mozilla.javascript.Scriptable
-
put
- Specified by:
putin interfaceorg.mozilla.javascript.Scriptable
-
delete
- Specified by:
deletein interfaceorg.mozilla.javascript.Scriptable
-
delete
public void delete(int index) - Specified by:
deletein interfaceorg.mozilla.javascript.Scriptable
-
getPrototype
public org.mozilla.javascript.Scriptable getPrototype()- Specified by:
getPrototypein interfaceorg.mozilla.javascript.Scriptable
-
setPrototype
public void setPrototype(org.mozilla.javascript.Scriptable prototype) - Specified by:
setPrototypein interfaceorg.mozilla.javascript.Scriptable
-
getParentScope
public org.mozilla.javascript.Scriptable getParentScope()- Specified by:
getParentScopein interfaceorg.mozilla.javascript.Scriptable
-
setParentScope
public void setParentScope(org.mozilla.javascript.Scriptable parent) - Specified by:
setParentScopein interfaceorg.mozilla.javascript.Scriptable
-
getIds
- Specified by:
getIdsin interfaceorg.mozilla.javascript.Scriptable
-
getDefaultValue
- Specified by:
getDefaultValuein interfaceorg.mozilla.javascript.Scriptable
-
hasInstance
public boolean hasInstance(org.mozilla.javascript.Scriptable value) - Specified by:
hasInstancein interfaceorg.mozilla.javascript.Scriptable
-
clear
public void clear() -
containsKey
- Specified by:
containsKeyin interfaceMap
-
containsValue
- Specified by:
containsValuein interfaceMap
-
entrySet
-
get
-
isEmpty
public boolean isEmpty() -
keySet
-
put
-
putAll
-
remove
-
size
public int size() -
values
-
toString
-