Copyright 2002 by aragost

com.aragost.servlet
Class MapAdapter

java.lang.Object
  |
  +--com.aragost.servlet.MapAdapter
All Implemented Interfaces:
java.util.Map
Direct Known Subclasses:
RequestAttributeMap, RequestParameterMap, ServletContextAttributeMap, ServletContextInitParameterMap, ServletInitParameterMap, SessionAttributeMap

public abstract class MapAdapter
extends java.lang.Object
implements java.util.Map

A MapAdapter is used to give a Map interface to attributes, parameters etc. of objects like HttpServerletRequest, HttpSession etc. Note at the moment some methods throws UnsupportedOpetionException. And others are implemented rather naive and takes lineary time.


Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Constructor Summary
MapAdapter()
           
 
Method Summary
protected abstract  java.lang.Object basicGet(java.lang.String key)
          Returns the value to which this map maps the specified key.
protected abstract  void basicPut(java.lang.String key, java.lang.Object value)
          Associates the specified value with the specified key in this map (optional operation).
protected abstract  void basicRemove(java.lang.String key)
          Removes the mapping for this key from this map if it is present (optional operation).
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set entrySet()
           
 java.lang.Object get(java.lang.Object key)
           
 boolean isEmpty()
           
protected abstract  java.util.Enumeration keyEnumeration()
          Return a enumeration with the keys of this Map.
 java.util.Iterator keyIterator()
          This method is not part of the Map interface, but is provided as a (faster) alternative to keySet().iterator()
 java.util.Set keySet()
           
 java.lang.Object put(java.lang.Object k, java.lang.Object value)
           
 void putAll(java.util.Map t)
           
 java.lang.Object remove(java.lang.Object k)
           
 int size()
           
 java.util.Collection values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MapAdapter

public MapAdapter()
Method Detail

clear

public void clear()
Specified by:
clear in interface java.util.Map
See Also:
Map.clear()

containsKey

public boolean containsKey(java.lang.Object key)
Specified by:
containsKey in interface java.util.Map
See Also:
Map.containsKey(Object)

containsValue

public boolean containsValue(java.lang.Object value)
Specified by:
containsValue in interface java.util.Map
See Also:
Map.containsValue(Object)

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
See Also:
Map.entrySet()

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map
See Also:
Map.isEmpty()

keySet

public java.util.Set keySet()
Specified by:
keySet in interface java.util.Map
See Also:
Map.keySet()

putAll

public void putAll(java.util.Map t)
Specified by:
putAll in interface java.util.Map
See Also:
Map.putAll(Map)

remove

public java.lang.Object remove(java.lang.Object k)
Specified by:
remove in interface java.util.Map
See Also:
Map.remove(Object)

size

public int size()
Specified by:
size in interface java.util.Map
See Also:
Map.size()

values

public java.util.Collection values()
Specified by:
values in interface java.util.Map
See Also:
Map.values()

get

public java.lang.Object get(java.lang.Object key)
Specified by:
get in interface java.util.Map
See Also:
The key must be a String.

put

public java.lang.Object put(java.lang.Object k,
                            java.lang.Object value)
Specified by:
put in interface java.util.Map
See Also:
The key must be a String.

keyIterator

public java.util.Iterator keyIterator()
This method is not part of the Map interface, but is provided as a (faster) alternative to keySet().iterator()

Returns:
DOCUMENT ME!

keyEnumeration

protected abstract java.util.Enumeration keyEnumeration()
Return a enumeration with the keys of this Map.

Returns:
DOCUMENT ME!

basicGet

protected abstract java.lang.Object basicGet(java.lang.String key)
Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

More formally, if this map contains a mapping from a key k to a value v such that (key==null ? k==null : key.equals(k)), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

Parameters:
key - key whose associated value is to be returned.
Returns:
the value to which this map maps the specified key, or null if the map contains no mapping for this key.
Throws:
java.lang.NullPointerException - key is null and this map does not not permit null keys (optional).
See Also:
containsKey(Object)

basicPut

protected abstract void basicPut(java.lang.String key,
                                 java.lang.Object value)
Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for this key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.))

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.

basicRemove

protected abstract void basicRemove(java.lang.String key)
Removes the mapping for this key from this map if it is present (optional operation). More formally, if this map contains a mapping from key k to value v such that (key==null ? k==null : key.equals(k)), that mapping is removed. (The map can contain at most one such mapping.)

Parameters:
key - key whose mapping is to be removed from the map.

Copyright 2002 by aragost