org.apache.commons.collections

Class ProxyMap

public abstract class ProxyMap extends Object implements Map

Deprecated: Moved to map subpackage as AbstractMapDecorator. It will be removed in v4.0.

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).

This implementation does not perform any special processing with entrySet, keySet or values. Instead it simply returns the set/collection from the wrapped map. This may be undesirable, for example if you are trying to write a validating implementation it would provide a loophole around the validation. But, you might want that loophole, so this class is kept simple.

Since: Commons Collections 2.0

Version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $

Author: Daniel Rall Stephen Colebourne

Field Summary
protected Mapmap
The Map to delegate to.
Constructor Summary
ProxyMap(Map map)
Constructor that uses the specified map to delegate to.
Method Summary
voidclear()
Invokes the underlying Map#clear() method.
booleancontainsKey(Object key)
Invokes the underlying Map#containsKey(Object) method.
booleancontainsValue(Object value)
Invokes the underlying Map#containsValue(Object) method.
SetentrySet()
Invokes the underlying Map#entrySet() method.
booleanequals(Object m)
Invokes the underlying Map#equals(Object) method.
Objectget(Object key)
Invokes the underlying Map#get(Object) method.
inthashCode()
Invokes the underlying Map#hashCode() method.
booleanisEmpty()
Invokes the underlying Map#isEmpty() method.
SetkeySet()
Invokes the underlying Map#keySet() method.
Objectput(Object key, Object value)
Invokes the underlying Map#put(Object,Object) method.
voidputAll(Map t)
Invokes the underlying Map#putAll(Map) method.
Objectremove(Object key)
Invokes the underlying Map#remove(Object) method.
intsize()
Invokes the underlying Map#size() method.
Collectionvalues()
Invokes the underlying Map#values() method.

Field Detail

map

protected Map map
The Map to delegate to.

Constructor Detail

ProxyMap

public ProxyMap(Map map)
Constructor that uses the specified map to delegate to.

Note that the map is used for delegation, and is not copied. This is different to the normal use of a Map parameter in collections constructors.

Parameters: map the Map to delegate to

Method Detail

clear

public void clear()
Invokes the underlying Map#clear() method.

containsKey

public boolean containsKey(Object key)
Invokes the underlying Map#containsKey(Object) method.

containsValue

public boolean containsValue(Object value)
Invokes the underlying Map#containsValue(Object) method.

entrySet

public Set entrySet()
Invokes the underlying Map#entrySet() method.

equals

public boolean equals(Object m)
Invokes the underlying Map#equals(Object) method.

get

public Object get(Object key)
Invokes the underlying Map#get(Object) method.

hashCode

public int hashCode()
Invokes the underlying Map#hashCode() method.

isEmpty

public boolean isEmpty()
Invokes the underlying Map#isEmpty() method.

keySet

public Set keySet()
Invokes the underlying Map#keySet() method.

put

public Object put(Object key, Object value)
Invokes the underlying Map#put(Object,Object) method.

putAll

public void putAll(Map t)
Invokes the underlying Map#putAll(Map) method.

remove

public Object remove(Object key)
Invokes the underlying Map#remove(Object) method.

size

public int size()
Invokes the underlying Map#size() method.

values

public Collection values()
Invokes the underlying Map#values() method.
Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.