org.formproc.conversion
Class DateConverter

java.lang.Object
  |
  +--org.formproc.conversion.AbstractTypeConverter
        |
        +--org.formproc.conversion.DateConverter
All Implemented Interfaces:
TypeConverter

public class DateConverter
extends AbstractTypeConverter

TypeConverter which converts to a Date. The data objects toString() method will be used to convert the data object to a String first.

This class includes a property parse which controls date parsing with following attributes: type, dateStyle, timeStyle, pattern.

Possible values for type attribute are:

  • date
  • time
  • datetime
  • both
  • custom

    Possible values for dateStyle and timeStyle attributes are:

  • default
  • short
  • medium
  • long
  • full

    For possible values for pattern see java.text.SimpleDateFormat apidocs.

    Author:
    Kalman Laszlo

    Constructor Summary
    DateConverter()
               
     
    Method Summary
     java.lang.Object convert(java.lang.Object data, java.util.Locale locale)
              Convert the given data object to a Date.
     void loadConfiguration(com.anthonyeden.lib.config.Configuration configuration)
              Load the converter's configuration.
     void setDateStyle(java.lang.String dateStyle)
              Set the date style property.
     void setPattern(java.lang.String pattern)
              Set the pattern property.
     void setTimeStyle(java.lang.String timeStyle)
              Set the time style property.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    DateConverter

    public DateConverter()
    Method Detail

    convert

    public java.lang.Object convert(java.lang.Object data,
                                    java.util.Locale locale)
                             throws java.lang.Exception
    Convert the given data object to a Date.

    Parameters:
    data - The data
    locale - The Locale
    Returns:
    The resulting object
    Throws:
    java.lang.Exception

    setDateStyle

    public void setDateStyle(java.lang.String dateStyle)
    Set the date style property.

    Parameters:
    dateStyle -

    setTimeStyle

    public void setTimeStyle(java.lang.String timeStyle)
    Set the time style property.

    Parameters:
    timeStyle -

    setPattern

    public void setPattern(java.lang.String pattern)
    Set the pattern property.

    Parameters:
    pattern -

    loadConfiguration

    public void loadConfiguration(com.anthonyeden.lib.config.Configuration configuration)
                           throws com.anthonyeden.lib.config.ConfigurationException
    Load the converter's configuration.

    Specified by:
    loadConfiguration in interface TypeConverter
    Overrides:
    loadConfiguration in class AbstractTypeConverter
    Parameters:
    configuration - The configuration object
    Throws:
    com.anthonyeden.lib.config.ConfigurationException


    Copyright (c) 2001-2003 Anthony Eden. All Rights Reserved.