org.apache.commons.collections.map

Class AbstractMapDecorator

Implemented Interfaces:
Map
Known Direct Subclasses:
AbstractBidiMapDecorator, AbstractOrderedMapDecorator, AbstractSortedMapDecorator, FixedSizeMap, LazyMap, ListOrderedMap, UnmodifiableMap

public abstract class AbstractMapDecorator
extends java.lang.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.

Version:
$Revision: 1.5 $ $Date: 2004/04/02 21:02:54 $
Authors:
Daniel Rall
Stephen Colebourne
Since:
Commons Collections 3.0

Field Summary

protected Map
map
The map to decorate

Constructor Summary

AbstractMapDecorator()
Constructor only used in deserialization, do not use otherwise.
AbstractMapDecorator(Map map)
Constructor that wraps (not copies).

Method Summary

void
clear()
boolean
containsKey(Object key)
boolean
containsValue(Object value)
Set
entrySet()
boolean
equals(Object object)
Object
get(Object key)
protected Map
getMap()
Gets the map being decorated.
int
hashCode()
boolean
isEmpty()
Set
keySet()
Object
put(Object key, Object value)
void
putAll(Map mapToCopy)
Object
remove(Object key)
int
size()
String
toString()
Collection
values()

Field Details

map

protected Map map
The map to decorate

Constructor Details

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

Method Details

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-2006 Apache Software Foundation. All Rights Reserved.