org.apache.commons.collections
Class ProxyMap

java.lang.Object
  |
  +--org.apache.commons.collections.ProxyMap
All Implemented Interfaces:
Map

public abstract class ProxyMap
extends Object
implements Map

This Map wraps another Map implementation, using the wrapped instance for its default implementation. This class is used as a framework on which to build to extensions for its wrapped Map object which would be unavailable or inconvenient via sub-classing (but usable via composition).

An example use case is where the wrapped Map needs synchronization (to make it thread-safe), but the Map returned by Collections.synchronizedMap(map) hides part of map's public interface.

Since:
2.0
Author:
Daniel Rall

Inner classes inherited from class java.util.Map
Map.Entry
 
Field Summary
protected  Map map
          The Map used for default implementations.
 
Constructor Summary
ProxyMap(Map map)
          Creates a new instance acting as a representative for the specified Map.
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 boolean equals(Object map)
           
 Object get(Object key)
           
 int hashCode()
           
 boolean isEmpty()
           
 Set keySet()
           
 Object put(Object key, Object value)
           
 void putAll(Map t)
           
 Object remove(Object key)
           
 int size()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected Map map
The Map used for default implementations.
Constructor Detail

ProxyMap

public ProxyMap(Map map)
Creates a new instance acting as a representative for the specified Map.
Parameters:
map - The Map to whose operations to wrap.
Method Detail

clear

public void clear()
Specified by:
clear in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

equals

public boolean equals(Object map)
Specified by:
equals in interface Map
Overrides:
equals in class Object

get

public Object get(Object key)
Specified by:
get in interface Map

hashCode

public int hashCode()
Specified by:
hashCode in interface Map
Overrides:
hashCode in class Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

keySet

public Set keySet()
Specified by:
keySet in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

putAll

public void putAll(Map t)
Specified by:
putAll in interface Map

remove

public Object remove(Object key)
Specified by:
remove in interface Map

size

public int size()
Specified by:
size in interface Map

values

public Collection values()
Specified by:
values in interface Map


Copyright © 2001 Apache Software Foundation. Documenation generated April 2 2002.