jodd.util.collection
Class StringKeyedMapAdapter

java.lang.Object
  extended by java.util.AbstractMap<java.lang.String,java.lang.Object>
      extended by jodd.util.collection.StringKeyedMapAdapter
All Implemented Interfaces:
java.util.Map<java.lang.String,java.lang.Object>
Direct Known Subclasses:
HttpServletContextMap, HttpServletRequestMap, HttpSessionMap, JspValueMap

public abstract class StringKeyedMapAdapter
extends java.util.AbstractMap<java.lang.String,java.lang.Object>

Adapter for map whose keys are String values.


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
StringKeyedMapAdapter()
           
 
Method Summary
 void clear()
          Removes all attributes from the request as well as clears entries in this map.
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
          Returns a Set of attributes from the http request.
 java.lang.Object get(java.lang.Object key)
          Returns the request attribute associated with the given key or null if it doesn't exist.
protected abstract  java.lang.Object getAttribute(java.lang.String key)
          Hooks method that needs to be implemented by concrete subclasses.
protected abstract  java.util.Iterator<java.lang.String> getAttributeNames()
          Hook method that needs to be implemented by concrete subclasses.
 java.lang.Object put(java.lang.String key, java.lang.Object value)
          Saves an attribute in the request.
 java.lang.Object remove(java.lang.Object key)
          Removes the specified request attribute.
protected abstract  void removeAttribute(java.lang.String key)
          Hooks method that needs to be implemented by concrete subclasses.
protected abstract  void setAttribute(java.lang.String key, java.lang.Object value)
          Hooks method that needs to be implemented by concrete subclasses.
 
Methods inherited from class java.util.AbstractMap
clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringKeyedMapAdapter

public StringKeyedMapAdapter()
Method Detail

getAttribute

protected abstract java.lang.Object getAttribute(java.lang.String key)
Hooks method that needs to be implemented by concrete subclasses. Gets a value associated with a key.


setAttribute

protected abstract void setAttribute(java.lang.String key,
                                     java.lang.Object value)
Hooks method that needs to be implemented by concrete subclasses. Puts a key-value pair in the map, overwriting any possible earlier value associated with the same key.


removeAttribute

protected abstract void removeAttribute(java.lang.String key)
Hooks method that needs to be implemented by concrete subclasses. Removes a key and its associated value from the map.


getAttributeNames

protected abstract java.util.Iterator<java.lang.String> getAttributeNames()
Hook method that needs to be implemented by concrete subclasses. Returns an enumeration listing all keys known to the map.


clear

public void clear()
Removes all attributes from the request as well as clears entries in this map.

Specified by:
clear in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
clear in class java.util.AbstractMap<java.lang.String,java.lang.Object>

entrySet

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Returns a Set of attributes from the http request.

Specified by:
entrySet in interface java.util.Map<java.lang.String,java.lang.Object>
Specified by:
entrySet in class java.util.AbstractMap<java.lang.String,java.lang.Object>

get

public java.lang.Object get(java.lang.Object key)
Returns the request attribute associated with the given key or null if it doesn't exist.

Specified by:
get in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
get in class java.util.AbstractMap<java.lang.String,java.lang.Object>

put

public java.lang.Object put(java.lang.String key,
                            java.lang.Object value)
Saves an attribute in the request.

Specified by:
put in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
put in class java.util.AbstractMap<java.lang.String,java.lang.Object>

remove

public java.lang.Object remove(java.lang.Object key)
Removes the specified request attribute.

Specified by:
remove in interface java.util.Map<java.lang.String,java.lang.Object>
Overrides:
remove in class java.util.AbstractMap<java.lang.String,java.lang.Object>


Copyright © 2003-2012 Jodd Team