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: 646777 $ $Date: 2008-04-10 14:33:15 +0200 (Thu, 10 Apr 2008) $
  Author:
    Stephen Colebourne
  See Also:
    Serialized Form

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Transformer` | `getInstance(Map map)` Factory to create the transformer.
    `Map` | `getMap()` Gets the map to lookup in.
    `Object` | `transform(Object input)` Transforms the input to result by looking it up in a `Map`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

    - #### transform

          public Object transform(Object input)

      Transforms the input to result by looking it up in a `Map`.
      Specified by:
        `transform` in interface `Transformer`
      Parameters:
        `input` - the input object to transform
      Returns:
        the transformed result

    - #### getMap

          public Map getMap()

      Gets the map to lookup in.
      Returns:
        the map
      Since:
        Commons Collections 3.1

Copyright © 2001–2015 The Apache Software Foundation. All rights reserved.