org.springframework.extensions.webscripts
Class ScriptableLinkedHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<K,V>
              extended by org.springframework.extensions.webscripts.ScriptableLinkedHashMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>, org.mozilla.javascript.Scriptable, ScriptableMap<K,V>

public class ScriptableLinkedHashMap<K,V>
extends LinkedHashMap<K,V>
implements ScriptableMap<K,V>

Implementation of a Scriptable Map. This is the best choice for maps that want to represent JavaScript associative arrays - allowing access via key and integer index. It maintains and respects insertion order of the elements and allows either string or integer keys.

Author:
Kevin Roast
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
ScriptableLinkedHashMap()
           
ScriptableLinkedHashMap(int initialCapacity)
           
ScriptableLinkedHashMap(Map<K,V> source)
           
 
Method Summary
 void delete(int index)
           
 void delete(String name)
           
 Object get(int index, org.mozilla.javascript.Scriptable start)
           
 Object get(String name, org.mozilla.javascript.Scriptable start)
           
 String getClassName()
           
 Object getDefaultValue(Class hint)
           
 Object[] getIds()
           
 org.mozilla.javascript.Scriptable getParentScope()
           
 org.mozilla.javascript.Scriptable getPrototype()
           
 boolean has(int index, org.mozilla.javascript.Scriptable start)
           
 boolean has(String name, org.mozilla.javascript.Scriptable start)
           
 boolean hasInstance(org.mozilla.javascript.Scriptable instance)
           
 void put(int index, org.mozilla.javascript.Scriptable start, Object value)
           
 void put(String name, org.mozilla.javascript.Scriptable start, Object value)
           
 void setParentScope(org.mozilla.javascript.Scriptable parent)
           
 void setPrototype(org.mozilla.javascript.Scriptable prototype)
           
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get, removeEldestEntry
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

ScriptableLinkedHashMap

public ScriptableLinkedHashMap()

ScriptableLinkedHashMap

public ScriptableLinkedHashMap(int initialCapacity)

ScriptableLinkedHashMap

public ScriptableLinkedHashMap(Map<K,V> source)
Method Detail

getClassName

public String getClassName()
Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.getClassName()

get

public Object get(String name,
                  org.mozilla.javascript.Scriptable start)
Specified by:
get in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.get(java.lang.String, org.mozilla.javascript.Scriptable)

get

public Object get(int index,
                  org.mozilla.javascript.Scriptable start)
Specified by:
get in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.get(int, org.mozilla.javascript.Scriptable)

has

public boolean has(String name,
                   org.mozilla.javascript.Scriptable start)
Specified by:
has in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.has(java.lang.String, org.mozilla.javascript.Scriptable)

has

public boolean has(int index,
                   org.mozilla.javascript.Scriptable start)
Specified by:
has in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.has(int, org.mozilla.javascript.Scriptable)

put

public void put(String name,
                org.mozilla.javascript.Scriptable start,
                Object value)
Specified by:
put in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.put(java.lang.String, org.mozilla.javascript.Scriptable, java.lang.Object)

put

public void put(int index,
                org.mozilla.javascript.Scriptable start,
                Object value)
Specified by:
put in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.put(int, org.mozilla.javascript.Scriptable, java.lang.Object)

delete

public void delete(String name)
Specified by:
delete in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.delete(java.lang.String)

delete

public void delete(int index)
Specified by:
delete in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.delete(int)

getPrototype

public org.mozilla.javascript.Scriptable getPrototype()
Specified by:
getPrototype in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.getPrototype()

setPrototype

public void setPrototype(org.mozilla.javascript.Scriptable prototype)
Specified by:
setPrototype in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.setPrototype(org.mozilla.javascript.Scriptable)

getParentScope

public org.mozilla.javascript.Scriptable getParentScope()
Specified by:
getParentScope in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.getParentScope()

setParentScope

public void setParentScope(org.mozilla.javascript.Scriptable parent)
Specified by:
setParentScope in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.setParentScope(org.mozilla.javascript.Scriptable)

getIds

public Object[] getIds()
Specified by:
getIds in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.getIds()

getDefaultValue

public Object getDefaultValue(Class hint)
Specified by:
getDefaultValue in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.getDefaultValue(java.lang.Class)

hasInstance

public boolean hasInstance(org.mozilla.javascript.Scriptable instance)
Specified by:
hasInstance in interface org.mozilla.javascript.Scriptable
See Also:
Scriptable.hasInstance(org.mozilla.javascript.Scriptable)


Copyright © 2009 SpringSource, Inc. All Rights Reserved.