org.scopemvc.util.convertor
Class TimeStringConvertor

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

public class TimeStringConvertor
extends DateStringConvertor

String convertor for type Time or java.util.Date . Date part of Date instances are ignored.

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.getTimeInstance(DateFormat.MEDIUM)
 
and default parsers are:
 DateFormat.getTimeInstance(DateFormat.FULL);
 DateFormat.getTimeInstance(DateFormat.LONG);
 DateFormat.getTimeInstance(DateFormat.MEDIUM);
 DateFormat.getTimeInstance(DateFormat.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:47 $
Author:
Daniel Michalik
, Steve Meyfroidt
See Also:
DateStringConvertor, DateTimeStringConvertor

Constructor Summary
TimeStringConvertor()
          Creates new TimeStringConvertor.
TimeStringConvertor(java.text.DateFormat inFormatter, java.text.DateFormat[] inParsers)
          Creates new TimeStringConvertor 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

TimeStringConvertor

public TimeStringConvertor()
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.


TimeStringConvertor

public TimeStringConvertor(java.text.DateFormat inFormatter,
                           java.text.DateFormat[] inParsers)
Creates new TimeStringConvertor 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.