public class NumberStyleFormatter 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 |
---|
NumberStyleFormatter()
Create a new NumberStyleFormatter without a pattern.
|
NumberStyleFormatter(java.lang.String pattern)
Create a new NumberStyleFormatter 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)
Specify the pattern to use to format number values.
|
parse, print, setLenient
public NumberStyleFormatter()
public NumberStyleFormatter(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
)