org.compass.core.converter.basic
Class AbstractNumberConverter

java.lang.Object
  extended by org.compass.core.converter.basic.AbstractBasicConverter
      extended by org.compass.core.converter.basic.AbstractFormatConverter
          extended by org.compass.core.converter.basic.AbstractNumberConverter
All Implemented Interfaces:
CompassConfigurable, FormatConverter, Converter, ResourcePropertyConverter
Direct Known Subclasses:
BigDecimalConverter, BigIntegerConverter, DoubleConverter, FloatConverter, IntConverter, LongConverter, ShortConverter

public abstract class AbstractNumberConverter
extends AbstractFormatConverter
implements CompassConfigurable

A base class for number based converters. Allows for formatting (if specified) and for default behaviour handling if none is provided.

Author:
kimchy

Field Summary
 
Fields inherited from class org.compass.core.converter.basic.AbstractFormatConverter
formatters, hasFormatter, locale
 
Constructor Summary
AbstractNumberConverter()
           
 
Method Summary
protected abstract  Object defaultFromString(String str, ResourcePropertyMapping resourcePropertyMapping)
           
protected  String defaultToString(Object o, ResourcePropertyMapping resourcePropertyMapping)
           
protected  ThreadSafeFormat.FormatterFactory doCreateFormatterFactory()
           
protected abstract  Object fromNumber(Number number)
           
 Object fromString(String str, ResourcePropertyMapping resourcePropertyMapping)
          Converts from a String and into it's Object representation.
 String toString(Object o, ResourcePropertyMapping resourcePropertyMapping)
          Default implementation of toString, simply calls the Object toString.
 
Methods inherited from class org.compass.core.converter.basic.AbstractFormatConverter
canNormalize, configure, copy, doGetDefaultFormat, setFormat
 
Methods inherited from class org.compass.core.converter.basic.AbstractBasicConverter
createProperty, doSetBoost, fromString, getNullValue, handleNulls, isNullValue, marshall, 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.config.CompassConfigurable
configure
 
Methods inherited from interface org.compass.core.converter.Converter
marshall, unmarshall
 

Constructor Detail

AbstractNumberConverter

public AbstractNumberConverter()
Method Detail

doCreateFormatterFactory

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

defaultFromString

protected abstract Object defaultFromString(String str,
                                            ResourcePropertyMapping resourcePropertyMapping)

fromNumber

protected abstract Object fromNumber(Number number)

defaultToString

protected String defaultToString(Object o,
                                 ResourcePropertyMapping resourcePropertyMapping)

fromString

public Object fromString(String str,
                         ResourcePropertyMapping resourcePropertyMapping)
Description copied from interface: ResourcePropertyConverter
Converts from a String and into it's Object representation.

Specified by:
fromString in interface ResourcePropertyConverter
Parameters:
str - The string to convert from
resourcePropertyMapping - The resource property mapping
Returns:
Theh object converterd from the String

toString

public String toString(Object o,
                       ResourcePropertyMapping resourcePropertyMapping)
Description copied from class: AbstractBasicConverter
Default implementation of toString, simply calls the Object toString.

Specified by:
toString in interface ResourcePropertyConverter
Overrides:
toString in class AbstractBasicConverter
Parameters:
o - The Object to convert from
resourcePropertyMapping - The resource proeprty mapping
Returns:
The String converted from the Object


Copyright (c) 2004-2006 The Compass Project.