public class NumberConverter extends AbstractConverter
java.lang.Number
types.
java.lang.Byte
java.lang.Short
java.lang.Integer
java.lang.Long
java.lang.Float
java.lang.Double
java.math.BigDecimal
java.math.BigInteger
java.util.concurrent.atomic.AtomicInteger
java.util.concurrent.atomic.AtomicLong
java.math.Boolean
to Long are also handled.Constructor and Description |
---|
NumberConverter() |
Modifier and Type | Method and Description |
---|---|
Class<? extends Number> |
getDefaultNumberImplem()
Default concrete Number implementation.
|
Locale |
getLocale() |
String |
getPattern() |
Class<?>[] |
getTypes()
Returns types handled by the converter.
|
protected String |
internalConvertToString(Object o)
Returns the default "toString" result on provided Object.
|
protected <T> T |
internalConvertToType(Class<T> type,
Object o)
Convert the input object into a Number object of the
specified type of defaultType if Number.class is requested.
|
boolean |
isUseLocaleFormat() |
void |
setLocale(Locale locale) |
void |
setPattern(String pattern) |
void |
setUseLocaleFormat(boolean useLocaleFormat) |
Object |
typeConversion(Class<?> type,
Object o)
Overridden to handle primitive default values.
|
convertArrayToString, convertArrayToType, convertCollectionToString, convertCollectionToType, convertionException, convertionException, convertToString, convertToType, stringConversion, toString
public Object typeConversion(Class<?> type, Object o) throws UtilsException
typeConversion
in interface IConverter
typeConversion
in class AbstractConverter
UtilsException
protected String internalConvertToString(Object o) throws UtilsException
AbstractConverter
internalConvertToString
in class AbstractConverter
UtilsException
protected <T> T internalConvertToType(Class<T> type, Object o) throws UtilsException
internalConvertToType
in class AbstractConverter
UtilsException
public Class<? extends Number> getDefaultNumberImplem()
public Class<?>[] getTypes()
IConverter
public String getPattern()
public void setPattern(String pattern)
public Locale getLocale()
public void setLocale(Locale locale)
public boolean isUseLocaleFormat()
public void setUseLocaleFormat(boolean useLocaleFormat)