Class MapTransformer
java.lang.Object
org.apache.commons.collections.functors.MapTransformer
- All Implemented Interfaces:
Serializable
,Transformer
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: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
The map of data to lookup inprivate static final long
Serial version UID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
MapTransformer
(Map map) Constructor that performs no validation. -
Method Summary
Modifier and TypeMethodDescriptionstatic Transformer
getInstance
(Map map) Factory to create the transformer.getMap()
Gets the map to lookup in.Transforms the input to result by looking it up in aMap
.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial version UID- See Also:
-
iMap
The map of data to lookup in
-
-
Constructor Details
-
MapTransformer
Constructor that performs no validation. UsegetInstance
if you want that.- Parameters:
map
- the map to use for lookup, not cloned
-
-
Method Details
-
getInstance
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
Transforms the input to result by looking it up in aMap
.- Specified by:
transform
in interfaceTransformer
- Parameters:
input
- the input object to transform- Returns:
- the transformed result
-
getMap
Gets the map to lookup in.- Returns:
- the map
- Since:
- Commons Collections 3.1
-