lumis.util.converter
Class DateTimeConverter

Package class diagram package DateTimeConverter
java.lang.Object
  extended by lumis.util.converter.AbstractConverter
      extended by lumis.util.converter.DateTimeConverter
All Implemented Interfaces:
IConverter
Direct Known Subclasses:
DateConverter, TimeConverter

public class DateTimeConverter
extends AbstractConverter

This converter is able to do conversion between Date and its java.sql subtypes, String and Long. Long is treated as UTC.

By default this converter uses the jvm date time formats, if pattern is not specified. Use TimeConverter or DateConverter to default to jvm date or time formats.

This class accepts patterns specified in SimpleDateFormat or the string "ISO8601" for ISO-8601 format pattern.

Since:
4.0.4
See Also:
Date

Nested Class Summary
protected static class DateTimeConverter.ISO8601DateTimeFormat
          Implementation of DateFormat for ISO-8601 parsing and formatting.
 
Field Summary
static String PATTERN_ISO_8601
           
 
Constructor Summary
DateTimeConverter()
           
 
Method Summary
protected  DateFormat createDateFormat(Locale locale, String pattern)
          Creates the DateFormat for the given locale and pattern.
protected
<T> T
doConversion(Class<T> type, Object value, Locale locale, String pattern)
          Converts the specified input object into an output object of the specified type.
 
Methods inherited from class lumis.util.converter.AbstractConverter
convert, convert, convert, doesNullValueReturnNull, doesValueInstanceOfTypeReturnValue, getDefaultLocale, getDefaultPattern, setDefaultLocale, setDefaultPattern, setFallbackToRegisteredConverters, shouldFallbackToRegisteredConverters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATTERN_ISO_8601

public static final String PATTERN_ISO_8601
See Also:
Constant Field Values
Constructor Detail

DateTimeConverter

public DateTimeConverter()
Method Detail

createDateFormat

protected DateFormat createDateFormat(Locale locale,
                                      String pattern)
Creates the DateFormat for the given locale and pattern.

Parameters:
locale - the locale.
pattern - the pattern.
Returns:
the DateFormat created.
Since:
4.0.4
See Also:
DateFormat

doConversion

protected <T> T doConversion(Class<T> type,
                             Object value,
                             Locale locale,
                             String pattern)
                  throws UnsupportedConversionTypeException
Description copied from class: AbstractConverter
Converts the specified input object into an output object of the specified type.

Specified by:
doConversion in class AbstractConverter
Type Parameters:
T - generics support for the data type specified.
Parameters:
type - data type to which the value should be converted.
value - the input value to be converted.
locale - locale to be used during conversion, if necessary.
pattern - converter specific conversion pattern, to be used during conversion, if necessary.
Throws:
UnsupportedConversionTypeException - if this converter does not supports converting to the specified type.


Lumisportal  5.5.0.091130 - Copyright © 2001-2007, Lumis. All Rights Reserved.