Package lumis.util.converter
Class NumberConverter
- java.lang.Object
-
- lumis.util.converter.AbstractConverter
-
- lumis.util.converter.NumberConverter
-
- All Implemented Interfaces:
IConverter
public class NumberConverter extends AbstractConverter
This converter is able to do conversion betweenNumber
subtypes in the java.lang package and String.- Since:
- 4.0.4
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description NumberConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.text.NumberFormat
createNumberFormat(java.util.Locale locale, java.lang.String pattern)
Creates the NumberFormat for the given locale and pattern.protected <T> T
doConversion(java.lang.Class<T> type, java.lang.Object value, java.util.Locale locale, java.lang.String pattern)
Converts the specified input object into an output object of the specified type.-
Methods inherited from class lumis.util.converter.AbstractConverter
convert, convert, convert, doesNullValueReturnNull, doesValueInstanceOfTypeReturnValue, getDefaultLocale, getDefaultPattern, setDefaultLocale, setDefaultPattern, setFallbackToRegisteredConverters, shouldFallbackToRegisteredConverters
-
-
-
-
Method Detail
-
createNumberFormat
protected java.text.NumberFormat createNumberFormat(java.util.Locale locale, java.lang.String pattern)
Creates the NumberFormat for the given locale and pattern.- Parameters:
locale
- the locale.pattern
- the pattern.- Returns:
- the DecimalFormat created.
- Since:
- 4.0.4
- See Also:
NumberFormat
-
doConversion
protected <T> T doConversion(java.lang.Class<T> type, java.lang.Object value, java.util.Locale locale, java.lang.String pattern) throws UnsupportedConversionTypeException
Description copied from class:AbstractConverter
Converts the specified input object into an output object of the specified type.- Specified by:
doConversion
in classAbstractConverter
- Type Parameters:
T
- generics support for the data type specified.- Parameters:
type
- data type to which the value should be converted.value
- the input value to be converted.locale
- locale to be used during conversion, if necessary.pattern
- converter specific conversion pattern, to be used during conversion, if necessary.- Throws:
UnsupportedConversionTypeException
- if this converter does not supports converting to the specified type.
-
-