org.codehaus.spice.converter.lib
Class StringToDateConverter

java.lang.Object
  |
  +--org.codehaus.spice.converter.AbstractConverter
        |
        +--org.codehaus.spice.converter.lib.StringToDateConverter
All Implemented Interfaces:
Converter

public class StringToDateConverter
extends AbstractConverter

String to Date converter.

Parses a date according to the same rules as the Date.parse() method. In particular it recognizes the IETF standard date syntax:

"Sat, 12 Aug 1995 13:30:00 GMT"

Version:
$Revision: 1.1 $ $Date: 2003/12/02 08:37:56 $
Author:
Peter Donald
See Also:
Date.parse(java.lang.String)

Constructor Summary
StringToDateConverter()
          Construct the converter.
StringToDateConverter(Date defaultValue)
          Construct the converter with a default value.
 
Method Summary
 Object convert(Object object, Object context)
          Converts a String to a Date.
 
Methods inherited from class org.codehaus.spice.converter.AbstractConverter
convert, noConvert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringToDateConverter

public StringToDateConverter()
Construct the converter.


StringToDateConverter

public StringToDateConverter(Date defaultValue)
Construct the converter with a default value. If the default value is non-null, it will be returned if unable to convert object to correct type.

Parameters:
defaultValue - the default value
Method Detail

convert

public Object convert(Object object,
                      Object context)
               throws ConverterException
Converts a String to a Date.

Specified by:
convert in class AbstractConverter
Parameters:
object - the original object to convert
context - the context in which to convert object (unused)
Returns:
the converted object
Throws:
ConverterException - if error converting object


Copyright © 2000-2003 Codehaus. All Rights Reserved.