org.compass.core.converter.basic
Class DateConverter

java.lang.Object
  extended by org.compass.core.converter.basic.AbstractBasicConverter<T>
      extended by org.compass.core.converter.basic.AbstractFormatConverter
          extended by org.compass.core.converter.basic.DateConverter
All Implemented Interfaces:
CompassConfigurable, FormatConverter, Converter, ContextResourcePropertyConverter, 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

Field Summary
static String DEFAULT_DATE_FORMAT
           
static String DEFAULT_NOW_PREFIX
           
 
Fields inherited from class org.compass.core.converter.basic.AbstractFormatConverter
formatters, hasFormatter, locale
 
Constructor Summary
DateConverter()
           
 
Method Summary
protected  FormatterFactory doCreateFormatterFactory()
           
protected  Object doFromString(String str, ResourcePropertyMapping resourcePropertyMapping, MarshallingContext context)
          Try all the configured formatters to format the str into an Object.
protected  String doGetDefaultFormat()
           
protected  String doToString(Object o, ResourcePropertyMapping resourcePropertyMapping, MarshallingContext context)
          Uses the first configured formatter (also known as the default one) to convert it to String.
 
Methods inherited from class org.compass.core.converter.basic.AbstractFormatConverter
canNormalize, configure, copy, setFormat, suggestIndex
 
Methods inherited from class org.compass.core.converter.basic.AbstractBasicConverter
createProperty, doSetBoost, fromString, fromString, getNullValue, handleNulls, isNullValue, marshall, suggestOmitNorms, suggestOmitTf, suggestStore, suggestTermVector, toString, toString, unmarshall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.core.converter.mapping.ResourcePropertyConverter
fromString, suggestOmitNorms, suggestOmitTf, suggestStore, suggestTermVector, toString
 
Methods inherited from interface org.compass.core.converter.Converter
marshall, unmarshall
 

Field Detail

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
Constructor Detail

DateConverter

public DateConverter()
Method Detail

doGetDefaultFormat

protected String doGetDefaultFormat()
Overrides:
doGetDefaultFormat in class AbstractFormatConverter

doCreateFormatterFactory

protected FormatterFactory doCreateFormatterFactory()
Specified by:
doCreateFormatterFactory in class AbstractFormatConverter

doFromString

protected Object doFromString(String str,
                              ResourcePropertyMapping resourcePropertyMapping,
                              MarshallingContext context)
                       throws ConversionException
Try all the configured formatters to format the str into an Object.

Specified by:
doFromString in class AbstractBasicConverter
Throws:
ConversionException

doToString

protected String doToString(Object o,
                            ResourcePropertyMapping resourcePropertyMapping,
                            MarshallingContext context)
Uses the first configured formatter (also known as the default one) to convert it to String.

Overrides:
doToString in class AbstractBasicConverter


Copyright (c) 2004-2009 The Compass Project.