com.fdsapi
Class ConverterDateToString

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

public class ConverterDateToString
extends ConverterBase

This class takes a Date Object and formats it into a String with a DateFormat object.

Note due to its use of the nonthread safe class NumberFormat this class is NOT thread safe. It could be wrapped in a ThreadSafe object if this is important. However when used with the ArrayConverter a new Converter will always be created at the appropriate time and so the developer need not worry about it. If a converter is used as say an instance variable in another class then you would need to ensure that a createInstance() is first called in a multithreaded environment.

Sample call:

  Converter converter=new ConverterNumToString();// default DateFormat including short date and time
  converter=new ConverterNumToString(DateFormat.getInstance());// same as default
  converter=new ConverterNumToString(DateFormat.getDateInstance());
  converter=new ConverterNumToString(DateFormat.getDateTimeInstance());
  ...
  



View Code


Constructor Summary
ConverterDateToString()
          Creates a new instance of ConverterNumToString
ConverterDateToString(Converter nextConverter)
          Constructor that takes the next converter in the decorator chain
ConverterDateToString(java.text.DateFormat dateFormat)
          Constructor that takes the formatter that will be used to format the date
ConverterDateToString(java.text.DateFormat dateFormat, Converter nextConverter)
          Constructor that takes the DateFormat object that will be used as well as the next Converter that will be called in the decorator chain.
 
Method Summary
 java.lang.Object convert(java.lang.Object inputObj)
           
protected  Converter createInstance(Converter nextConverter)
          Creates a cloned/copy of 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

ConverterDateToString

public ConverterDateToString()
Creates a new instance of ConverterNumToString


ConverterDateToString

public ConverterDateToString(java.text.DateFormat dateFormat)
Constructor that takes the formatter that will be used to format the date


ConverterDateToString

public ConverterDateToString(Converter nextConverter)
Constructor that takes the next converter in the decorator chain


ConverterDateToString

public ConverterDateToString(java.text.DateFormat dateFormat,
                             Converter nextConverter)
Constructor that takes the DateFormat object that will be used as well as the next Converter that will be called in the decorator chain.

Method Detail

convert

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

createInstance

protected Converter createInstance(Converter nextConverter)
Creates a cloned/copy of this Object. This method is called by the parent class

Specified by:
createInstance in class ConverterBase