org.sape.carbon.core.config.type.handlers
Class DateTypeHandler

java.lang.Object
  |
  +--org.sape.carbon.core.config.type.handlers.DateTypeHandler
All Implemented Interfaces:
ConfigurationTypeHandler

public class DateTypeHandler
extends Object
implements ConfigurationTypeHandler

Parses and formats between Strings and Dates in the format of "MM/dd/yyyy". An example is "08/07/2002" or August 7th, 2002.

Copyright 2002 Sapient

Since:
carbon 1.0
Version:
$Revision: 1.10 $($Author: dvoet $ / $Date: 2003/05/05 21:21:20 $)
Author:
Greg Hinkle, January 2002

Field Summary
private static DateFormat dateFormat
          A Date Formatter for the format of "MM/dd/YYYY"
 
Constructor Summary
DateTypeHandler()
           
 
Method Summary
 Object toObject(Class type, String stringValue)
          Parses a string into a Date object.
 String toString(Object objectValue)
          Formats an Date into a String value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormat

private static DateFormat dateFormat
A Date Formatter for the format of "MM/dd/YYYY"

Constructor Detail

DateTypeHandler

public DateTypeHandler()
Method Detail

toObject

public Object toObject(Class type,
                       String stringValue)
                throws TypeConversionException

Parses a string into a Date object.

Specified by:
toObject in interface ConfigurationTypeHandler
Parameters:
stringValue - the String representation of the requested Date
type - String
Returns:
Date version of the given String
Throws:
TypeConversionException - when the string does not represent a valid Date

toString

public String toString(Object objectValue)

Formats an Date into a String value.

Specified by:
toString in interface ConfigurationTypeHandler
Parameters:
objectValue - the Date to be formatted
Returns:
String version of the Date
Throws:
ClassCastException - when past an object other than a Date


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.