org.pf.util
Class MapWrapper

java.lang.Object
  extended by org.pf.util.MapWrapper
All Implemented Interfaces:
java.io.Serializable, java.util.Map
Direct Known Subclasses:
CaseInsensitiveKeyMap, ExtendedMap, StackedMap, TemporaryMap

public class MapWrapper
extends java.lang.Object
implements java.util.Map, java.io.Serializable

This is a wrapper class that implements the java.util.Map interface and contains an internal map. All method calls are routed directly to the internal map.
Therefore it makes no sense to use this class directly. It is rather meant to be the superclass for other map-wrapping classes that want to slightly change the behaviour. These subclasses only have to override those methods they really want to change the behaviour of.

Version:
1.1
Author:
Manfred Duchrow
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Constructor Summary
MapWrapper()
          Initialize the new instance with default values.
MapWrapper(int initialCapacity)
          Initialize the new instance with default values.
MapWrapper(java.util.Map mapToBeWrapped)
          Initialize the new instance with the given map
 
Method Summary
 void clear()
          Removes all entries from this map.
 boolean containsKey(java.lang.Object key)
          This method returns true, if the given key can be found in this map.
 boolean containsValue(java.lang.Object value)
          This method returns true, if the given value is a value of any entry in this map.
 java.util.Set entrySet()
          Returns all entries of the map
 java.lang.Object get(java.lang.Object key)
          Returns the object that was registered under the specified key.
 boolean isEmpty()
          Returns true, if there is no entry in this map.
 java.util.Set keySet()
          Returns all keys in this map.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Puts the given value under the specified key into the map.
 void putAll(java.util.Map map)
          Each entry of the given map will be added.
 java.lang.Object remove(java.lang.Object key)
          Removes the entry with the specified key.
 int size()
          Returns how many entries currently are in this map.
 java.util.Collection values()
          Returns all values of the map.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

MapWrapper

public MapWrapper()
Initialize the new instance with default values. An empty internal map will be created automatically.


MapWrapper

public MapWrapper(int initialCapacity)
Initialize the new instance with default values. An empty internal map will be created automatically.

Parameters:
initialCapacity - Defines how many "slots" for elements are created initially

MapWrapper

public MapWrapper(java.util.Map mapToBeWrapped)
Initialize the new instance with the given map

Method Detail

clear

public void clear()
Removes all entries from this map.

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

containsKey

public boolean containsKey(java.lang.Object key)
This method returns true, if the given key can be found in this map.

Specified by:
containsKey in interface java.util.Map
See Also:
Map.containsKey(Object)

containsValue

public boolean containsValue(java.lang.Object value)
This method returns true, if the given value is a value of any entry in this map.

Specified by:
containsValue in interface java.util.Map
See Also:
Map.containsValue(Object)

entrySet

public java.util.Set entrySet()
Returns all entries of the map

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

get

public java.lang.Object get(java.lang.Object key)
Returns the object that was registered under the specified key.

Specified by:
get in interface java.util.Map
See Also:
Map.get(Object)

isEmpty

public boolean isEmpty()
Returns true, if there is no entry in this map.

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

keySet

public java.util.Set keySet()
Returns all keys in this map.

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

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Puts the given value under the specified key into the map.

Specified by:
put in interface java.util.Map
See Also:
Map.put(Object, Object)

putAll

public void putAll(java.util.Map map)
Each entry of the given map will be added.

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

remove

public java.lang.Object remove(java.lang.Object key)
Removes the entry with the specified key.

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

size

public int size()
Returns how many entries currently are in this map.

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

values

public java.util.Collection values()
Returns all values of the map.

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