org.apache.commons.collections.map

Class AbstractMapDecorator

public abstract class AbstractMapDecorator extends Object implements Map

Provides a base decorator that enables additional functionality to be added to a Map via decoration.

Methods are forwarded directly to the decorated map.

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 3.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 decorate
Constructor Summary
protected AbstractMapDecorator()
Constructor only used in deserialization, do not use otherwise.
AbstractMapDecorator(Map map)
Constructor that wraps (not copies).
Method Summary
voidclear()
booleancontainsKey(Object key)
booleancontainsValue(Object value)
SetentrySet()
booleanequals(Object object)
Objectget(Object key)
protected MapgetMap()
Gets the map being decorated.
inthashCode()
booleanisEmpty()
SetkeySet()
Objectput(Object key, Object value)
voidputAll(Map mapToCopy)
Objectremove(Object key)
intsize()
StringtoString()
Collectionvalues()

Field Detail

map

protected transient Map map
The map to decorate

Constructor Detail

AbstractMapDecorator

protected AbstractMapDecorator()
Constructor only used in deserialization, do not use otherwise.

Since: Commons Collections 3.1

AbstractMapDecorator

public AbstractMapDecorator(Map map)
Constructor that wraps (not copies).

Parameters: map the map to decorate, must not be null

Throws: IllegalArgumentException if the collection is null

Method Detail

clear

public void clear()

containsKey

public boolean containsKey(Object key)

containsValue

public boolean containsValue(Object value)

entrySet

public Set entrySet()

equals

public boolean equals(Object object)

get

public Object get(Object key)

getMap

protected Map getMap()
Gets the map being decorated.

Returns: the decorated map

hashCode

public int hashCode()

isEmpty

public boolean isEmpty()

keySet

public Set keySet()

put

public Object put(Object key, Object value)

putAll

public void putAll(Map mapToCopy)

remove

public Object remove(Object key)

size

public int size()

toString

public String toString()

values

public Collection values()
Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.