org.apache.commons.collections.functors
Class MapTransformer
java.lang.Object
|
+--org.apache.commons.collections.functors.MapTransformer
- All Implemented Interfaces:
- Serializable, Transformer
- public final class MapTransformer
- extends Object
- implements Transformer, Serializable
Transformer implementation that returns the value held in a specified map
using the input parameter as a key.
- Since:
- Commons Collections 3.0
- Version:
- $Revision: 1.4 $ $Date: 2004/01/14 21:43:09 $
- Author:
- Stephen Colebourne
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static Transformer getInstance(Map map)
- Factory to create the transformer.
If the map is null, a transformer that always returns null is returned.
- Parameters:
map
- the map, not cloned- Returns:
- the transformer
transform
public Object transform(Object input)
- Returns the result by looking up in the map.
- Specified by:
transform
in interface Transformer
- Following copied from interface:
org.apache.commons.collections.Transformer
- Parameters:
input
- the object to be transformed- Returns:
- a transformed object
- Throws:
ClassCastException
- (runtime) if the input is the wrong classIllegalArgumentException
- (runtime) if the input is invalidFunctorException
- (runtime) if the transform cannot be completed
Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.