org.apache.commons.convert
Class NumberConverters.AbstractNumberToStringConverter<N extends Number>

java.lang.Object
  extended by org.apache.commons.convert.AbstractConverter<S,T>
      extended by org.apache.commons.convert.AbstractLocalizedConverter<N,String>
          extended by org.apache.commons.convert.NumberConverters.AbstractNumberToStringConverter<N>
All Implemented Interfaces:
Converter<N,String>, ConverterLoader, LocalizedConverter<N,String>
Direct Known Subclasses:
NumberConverters.BigDecimalToString, NumberConverters.BigIntegerToString, NumberConverters.ByteToString, NumberConverters.DoubleToString, NumberConverters.FloatToString, NumberConverters.IntegerToString, NumberConverters.LongToString, NumberConverters.ShortToString
Enclosing class:
NumberConverters

public abstract static class NumberConverters.AbstractNumberToStringConverter<N extends Number>
extends AbstractLocalizedConverter<N,String>

An abstract Number to String converter class that implements some of the LocalizedConverter methods.


Constructor Summary
NumberConverters.AbstractNumberToStringConverter(Class<N> sourceClass)
           
 
Method Summary
 String convert(N obj)
          Converts obj to T.
 String convert(N obj, Locale locale, TimeZone timeZone, String formatString)
          Converts obj to T.
protected abstract  String format(N obj, NumberFormat nf)
           
 
Methods inherited from class org.apache.commons.convert.AbstractLocalizedConverter
convert
 
Methods inherited from class org.apache.commons.convert.AbstractConverter
canConvert, getSourceClass, getTargetClass, loadConverters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.convert.Converter
canConvert, getSourceClass, getTargetClass
 

Constructor Detail

NumberConverters.AbstractNumberToStringConverter

public NumberConverters.AbstractNumberToStringConverter(Class<N> sourceClass)
Method Detail

convert

public String convert(N obj)
               throws ConversionException
Description copied from interface: Converter
Converts obj to T.

Parameters:
obj - The source Object to convert
Returns:
The converted Object
Throws:
ConversionException

convert

public String convert(N obj,
                      Locale locale,
                      TimeZone timeZone,
                      String formatString)
               throws ConversionException
Description copied from interface: LocalizedConverter
Converts obj to T.

Parameters:
obj - The source Object to convert
locale - The locale used for conversion - must not be null
timeZone - The time zone used for conversion - must not be null
formatString - Optional formatting string
Returns:
The converted Object
Throws:
ConversionException

format

protected abstract String format(N obj,
                                 NumberFormat nf)
                          throws ConversionException
Throws:
ConversionException


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.