org.compass.core.converter.basic
Class DateConverter
java.lang.Object
org.compass.core.converter.basic.AbstractBasicConverter
org.compass.core.converter.basic.AbstractFormatConverter
org.compass.core.converter.basic.DateConverter
- All Implemented Interfaces:
- CompassConfigurable, FormatConverter, Converter, ResourcePropertyConverter
- Direct Known Subclasses:
- CalendarConverter, SqlDateConverter, SqlTimeConverter, SqlTimestampConverter
public class DateConverter
- extends AbstractFormatConverter
Converts dates to String and vice versa. Supports the notion of "now" using
DateMathParser.
- Author:
- kimchy
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_NOW_PREFIX
public static final String DEFAULT_NOW_PREFIX
- See Also:
- Constant Field Values
DEFAULT_DATE_FORMAT
public static final String DEFAULT_DATE_FORMAT
- See Also:
- Constant Field Values
DateConverter
public DateConverter()
doGetDefaultFormat
protected String doGetDefaultFormat()
- Overrides:
doGetDefaultFormat in class AbstractFormatConverter
doCreateFormatterFactory
protected ThreadSafeFormat.FormatterFactory doCreateFormatterFactory()
- Specified by:
doCreateFormatterFactory in class AbstractFormatConverter
fromString
public Object fromString(String str,
ResourcePropertyMapping resourcePropertyMapping)
throws ConversionException
- Try all the configured formatters to format the str into an Object.
- Parameters:
str - The string to convert fromresourcePropertyMapping - The resource property mapping
- Returns:
- Theh object converterd from the String
- Throws:
ConversionException
toString
public String toString(Object o,
ResourcePropertyMapping resourcePropertyMapping)
throws ConversionException
- Uses the first configured formatter (also known as the default one) to convert it to String.
- Specified by:
toString in interface ResourcePropertyConverter- Overrides:
toString in class AbstractBasicConverter
- Parameters:
o - The Object to convert fromresourcePropertyMapping - The resource proeprty mapping
- Returns:
- The String converted from the Object
- Throws:
ConversionException
Copyright (c) 2004-2006 The Compass Project.