org.compass.core.converter.basic
Class AbstractFormatConverter
java.lang.Object
org.compass.core.converter.basic.AbstractBasicConverter
org.compass.core.converter.basic.AbstractFormatConverter
- All Implemented Interfaces:
- CompassConfigurable, FormatConverter, Converter, ResourcePropertyConverter
- Direct Known Subclasses:
- AbstractNumberConverter, DateConverter
public abstract class AbstractFormatConverter
- extends AbstractBasicConverter
- implements CompassConfigurable, FormatConverter
A base class that can handle ThreadSafeFormat and provide formatting support.
The format is read from a configuration setting CompassEnvironment.Converter.Format#FORMAT.
Uses a pool of formatters for better performance, using CompassEnvironment.Converter.Format#MIN_POOL_SIZE,
and CompassEnvironment.Converter.Format#MAX_POOL_SIZE as configuration settings for the pool size.
If specific locale is required for the formatted, the CompassEnvironment.Converter.Format#LOCALE can
be used to specify the required locale.
Allows to specify the default format if none is provided by overriding doGetDefaultFormat().
- Author:
- kimchy
| Methods inherited from class org.compass.core.converter.basic.AbstractBasicConverter |
createProperty, doFromString, doSetBoost, doToString, fromString, fromString, getNullValue, handleNulls, isNullValue, marshall, toString, toString, unmarshall |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
formatters
protected ThreadSafeFormat[] formatters
hasFormatter
protected boolean hasFormatter
locale
protected Locale locale
AbstractFormatConverter
public AbstractFormatConverter()
configure
public void configure(CompassSettings settings)
throws CompassException
- Description copied from interface:
CompassConfigurable
- Configure using the given settings.
- Specified by:
configure in interface CompassConfigurable
- Parameters:
settings - The settings for the configured object
- Throws:
CompassException
setFormat
public void setFormat(String format)
- Description copied from interface:
FormatConverter
- Sets the format for the
Converter.
- Specified by:
setFormat in interface FormatConverter
copy
public FormatConverter copy()
- Description copied from interface:
FormatConverter
- Returns a copy of the format converter.
- Specified by:
copy in interface FormatConverter
doCreateFormatterFactory
protected abstract ThreadSafeFormat.FormatterFactory doCreateFormatterFactory()
doGetDefaultFormat
protected String doGetDefaultFormat()
canNormalize
public boolean canNormalize()
- Format based converters should can be used (and should) when using query parser notation.
Returns
true.
- Specified by:
canNormalize in interface ResourcePropertyConverter- Overrides:
canNormalize in class AbstractBasicConverter
Copyright (c) 2004-2006 The Compass Project.