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

java.lang.Object
  extended by org.apache.commons.convert.AbstractConverter<S,T>
      extended by org.apache.commons.convert.AbstractLocalizedConverter<String,N>
          extended by org.apache.commons.convert.NumberConverters.AbstractStringToNumberConverter<N>
All Implemented Interfaces:
Converter<String,N>, ConverterLoader, LocalizedConverter<String,N>
Direct Known Subclasses:
NumberConverters.StringToBigDecimal, NumberConverters.StringToBigInteger, NumberConverters.StringToDouble, NumberConverters.StringToFloat, NumberConverters.StringToInteger, NumberConverters.StringToLong
Enclosing class:
NumberConverters

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

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


Constructor Summary
NumberConverters.AbstractStringToNumberConverter(Class<N> targetClass)
           
 
Method Summary
protected abstract  N convert(Number number)
           
 N convert(String obj, Locale locale, TimeZone timeZone, String formatString)
          Converts obj to T.
 
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, convert, getSourceClass, getTargetClass
 

Constructor Detail

NumberConverters.AbstractStringToNumberConverter

public NumberConverters.AbstractStringToNumberConverter(Class<N> targetClass)
Method Detail

convert

protected abstract N convert(Number number)
                                     throws ConversionException
Throws:
ConversionException

convert

public N convert(String 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


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