public class NumberFormatter extends AbstractNumberFormatter
Delegates to NumberFormat.getInstance(Locale)
.
Configures BigDecimal parsing so there is no loss in precision.
Allows configuration over the decimal number pattern.
The AbstractNumberFormatter.parse(String, Locale)
routine always returns a BigDecimal.
setPattern(java.lang.String)
,
AbstractNumberFormatter.setLenient(boolean)
Constructor and Description |
---|
NumberFormatter()
Create a new NumberFormatter without a pattern.
|
NumberFormatter(java.lang.String pattern)
Create a new NumberFormatter with the specified pattern.
|
Modifier and Type | Method and Description |
---|---|
java.text.NumberFormat |
getNumberFormat(java.util.Locale locale)
Obtain a concrete NumberFormat for the specified locale.
|
void |
setPattern(java.lang.String pattern)
Sets the pattern to use to format number values.
|
parse, print, setLenient
public NumberFormatter()
public NumberFormatter(java.lang.String pattern)
pattern
- the format patternsetPattern(java.lang.String)
public void setPattern(java.lang.String pattern)
DecimalFormat.applyPattern(String)
public java.text.NumberFormat getNumberFormat(java.util.Locale locale)
AbstractNumberFormatter
getNumberFormat
in class AbstractNumberFormatter
locale
- the current localenull
)