org.apache.commons.collections.map
Class TransformedMap
java.lang.Object
|
+--org.apache.commons.collections.map.AbstractMapDecorator
|
+--org.apache.commons.collections.map.TransformedMap
- All Implemented Interfaces:
- java.util.Map
- Direct Known Subclasses:
- TransformedSortedMap
- public class TransformedMap
- extends AbstractMapDecorator
Decorates another Map to transform objects that are added.
The Map put methods and Map.Entry setValue method are affected by this class.
Thus objects must be removed or searched for using their transformed form.
For example, if the transformation converts Strings to Integers, you must
use the Integer form to remove objects.
- Since:
- Commons Collections 3.0
- Version:
- $Revision: 1.5 $ $Date: 2004/01/14 21:43:10 $
- Author:
- Stephen Colebourne
|
Method Summary |
static java.util.Map |
decorate(java.util.Map map,
Transformer keyTransformer,
Transformer valueTransformer)
Factory method to create a transforming map. |
java.util.Set |
entrySet()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
|
void |
putAll(java.util.Map mapToCopy)
|
| Methods inherited from class org.apache.commons.collections.map.AbstractMapDecorator |
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, keySet, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
decorate
public static java.util.Map decorate(java.util.Map map,
Transformer keyTransformer,
Transformer valueTransformer)
- Factory method to create a transforming map.
If there are any elements already in the map being decorated, they
are NOT transformed.
- Parameters:
map - the map to decorate, must not be nullkeyTransformer - the transformer to use for key conversion, null means no conversionvalueTransformer - the transformer to use for value conversion, null means no conversion
- Throws:
java.lang.IllegalArgumentException - if map is null
put
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
- Specified by:
put in interface java.util.Map- Overrides:
put in class AbstractMapDecorator
putAll
public void putAll(java.util.Map mapToCopy)
- Specified by:
putAll in interface java.util.Map- Overrides:
putAll in class AbstractMapDecorator
entrySet
public java.util.Set entrySet()
- Specified by:
entrySet in interface java.util.Map- Overrides:
entrySet in class AbstractMapDecorator
Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.