⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
org.apache.commons.collections.functors

Class MapTransformer

java.lang.Object
|
+--org.apache.commons.collections.functors.MapTransformer

All Implemented Interfaces:
Transformer, Serializable


public final class MapTransformer
extends java.lang.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
Author:
Stephen Colebourne

Method Summary

static Transformer

getInstance(Map map)

Factory to create the transformer.

Object

transform(Object input)

Returns the result by looking up in the map.

Method Details

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.

Parameters:
input