public static class ParameterConverters.NumberConverter extends Object implements ParameterConverters.ParameterConverter
Converts values to numbers, supporting any subclass of Number
(including generic Number type), and it unboxed counterpart, using a
NumberFormat to parse to a Number and to convert it to a
specific number type:
Number.byteValue()Number.shortValue()Number.intValue()Number.floatValue()Number.longValue()Number.doubleValue()BigInteger#valueOf(Long)BigDecimal#valueOf(Double)NumberFormat#getInstance(Locale.ENGLISH).
The localized instance NumberFormat.getInstance(Locale) can be
used to convert numbers in specific locales.
| Constructor and Description |
|---|
NumberConverter() |
NumberConverter(NumberFormat numberFormat) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(Type type) |
Object |
convertValue(String value,
Type type) |
public NumberConverter()
public NumberConverter(NumberFormat numberFormat)
public boolean accept(Type type)
accept in interface ParameterConverters.ParameterConverterpublic Object convertValue(String value, Type type)
convertValue in interface ParameterConverters.ParameterConverterCopyright © 2003–2016. All rights reserved.