public class FormattedStringToNumber extends StringToObject
DecimalFormat instance returned by calling
NumberFormat.getInstance(Locale) by default. This instance supports parsing any number type generally and
will not perform special type-specific logic such as rounding or truncation. Subclasses may override.
Will coerse parsed Numbers to the desired numberClass as necessary. If type-coersion results in an overflow
condition; for example, what can occur with a Long being coersed to a Short, an exception will be thrown.NumberFormat,
DecimalFormat| Constructor and Description |
|---|
FormattedStringToNumber() |
FormattedStringToNumber(Class numberClass) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
getLenient()
If this Converter is "lenient" in parsing number strings.
|
void |
setLenient(boolean lenient)
Sets if this Converter should parse leniently.
|
void |
setNumberFormatFactory(NumberFormatFactory numberFormatFactory)
Sets the factory that returns the
NumberFormat instance that will format numbers handled by this
converter. |
convertSourceToTargetClass, convertTargetToSourceClass, getSourceClass, getTargetClasspublic FormattedStringToNumber()
public FormattedStringToNumber(Class numberClass)
public void setNumberFormatFactory(NumberFormatFactory numberFormatFactory)
NumberFormat instance that will format numbers handled by this
converter.numberFormatFactory - the number format factorypublic boolean getLenient()
public void setLenient(boolean lenient)
lenient - the lenient flag