org.apache.commons.collections.functors

Class MapTransformer

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: 348444 $ $Date: 2005-11-23 14:06:56 +0000 (Wed, 23 Nov 2005) $

Author: Stephen Colebourne

Method Summary
static TransformergetInstance(Map map)
Factory to create the transformer.
MapgetMap()
Gets the map to lookup in.
Objecttransform(Object input)
Transforms the input to result by looking it up in a Map.

Method Detail

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

getMap

public Map getMap()
Gets the map to lookup in.

Returns: the map

Since: Commons Collections 3.1

transform

public Object transform(Object input)
Transforms the input to result by looking it up in a Map.

Parameters: input the input object to transform

Returns: the transformed result

Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.