org.scopemvc.util.convertor
Class DateTimeStringConvertor

java.lang.Object
  |
  +--org.scopemvc.util.convertor.NullStringConvertor
        |
        +--org.scopemvc.util.convertor.DateStringConvertor
              |
              +--org.scopemvc.util.convertor.DateTimeStringConvertor
All Implemented Interfaces:
StringConvertor

public class DateTimeStringConvertor
extends DateStringConvertor

String convertor for type DateTime or java.util.Date . Both date and time parts of Date instances are used.

It uses one java.text.DateFormat DateFormat for converting into String and an array of DateFormats for parsing. Parsing formats are successively used to try to parse until one is successful.

Formats are picked up from config (see DefaultScopeConfig for details) or if none in config, the default formatter is:

 DateFormat.getDateTimeInstance()
 
and default parsers are:
 DateFormat.getDateTimeInstance((FULL|LONG|MEDIUM|SHORT),
                                      (FULL|LONG|MEDIUM|SHORT));
 
Note: the default parsing set is initialized during class loading and based on default platform locale. If application uses other locales, there will be need to set parsing objects explicitly.

Version:
$Revision: 1.5 $ $Date: 2002/09/05 15:41:46 $
Author:
Daniel Michalik
, Steve Meyfroidt
See Also:
DateStringConvertor, TimeStringConvertor

Constructor Summary
DateTimeStringConvertor()
          Creates new TimeStringConvertor.
DateTimeStringConvertor(java.text.DateFormat inFormatter, java.text.DateFormat[] inParsers)
          Creates new DateTimeStringConvertor with specified formatter and parsers.
 
Method Summary
protected  java.text.DateFormat[] getDefaultParsers()
          Gets the default parsers
 
Methods inherited from class org.scopemvc.util.convertor.DateStringConvertor
initDefaults, setFormatter, setParsers, stringAsValue, valueAsString
 
Methods inherited from class org.scopemvc.util.convertor.NullStringConvertor
getNullAsString, isNull, setNullAsString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateTimeStringConvertor

public DateTimeStringConvertor()
Creates new TimeStringConvertor. If formats and parsers are specified in config then use those else use current locale default format and platform locale default parsers.


DateTimeStringConvertor

public DateTimeStringConvertor(java.text.DateFormat inFormatter,
                               java.text.DateFormat[] inParsers)
Creates new DateTimeStringConvertor with specified formatter and parsers.

Parameters:
inFormatter - TODO: Describe the Parameter
inParsers - TODO: Describe the Parameter
Method Detail

getDefaultParsers

protected java.text.DateFormat[] getDefaultParsers()
Gets the default parsers

Overrides:
getDefaultParsers in class DateStringConvertor
Returns:
The defaultParsers value


Copyright © 2000-2002 The Scope Team. All Rights Reserved.