com.fdsapi
Class ConverterMapValue

java.lang.Object
  |
  +--com.fdsapi.ConverterBase
        |
        +--com.fdsapi.ConverterMapValue
All Implemented Interfaces:
Converter

public class ConverterMapValue
extends ConverterBase

This class looks for the Object passed to the convert method in a HashMap and replaces this key with the associated value in the Map (if key then replace with value). Note both key and value can be ANY Object type or null.

Sample call:

  Map map=new HashMap();
  map.put(null," ");
  map.put(""," ");
  map.put(new Boolean(true),"yes");
  map.put(new Boolean(false),"no");

  Converter converter=new ConverterMapValue(map);// default DateFormat including short date and time
  Object output=converter.convert(null);  // returns " " 
  ...
  



View Code


Constructor Summary
ConverterMapValue(java.util.Map map)
          Constructor that takes the map that the convert method uses to see what keys to replace with what value
ConverterMapValue(java.util.Map map, Converter nextConverter)
          Constructor that takes the map that the convert method uses to see what keys to replace with what values as well as the next Converter in the decorator chain.
 
Method Summary
 java.lang.Object convert(java.lang.Object inputObj)
           
protected  Converter createInstance(Converter nextConverter)
          Method that works like clone in that it returns a usable copy of the this Object
 
Methods inherited from class com.fdsapi.ConverterBase
createInstance, decoratorConvert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConverterMapValue

public ConverterMapValue(java.util.Map map)
Constructor that takes the map that the convert method uses to see what keys to replace with what value


ConverterMapValue

public ConverterMapValue(java.util.Map map,
                         Converter nextConverter)
Constructor that takes the map that the convert method uses to see what keys to replace with what values as well as the next Converter in the decorator chain.

Method Detail

convert

public java.lang.Object convert(java.lang.Object inputObj)

createInstance

protected Converter createInstance(Converter nextConverter)
Method that works like clone in that it returns a usable copy of the this Object

Specified by:
createInstance in class ConverterBase