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(String pattern)
Create a new NumberStyleFormatter with the specified pattern.
|
Modifier and Type | Method and Description |
---|---|
NumberFormat |
getNumberFormat(Locale locale)
Obtain a concrete NumberFormat for the specified locale.
|
void |
setPattern(String pattern)
Specify the pattern to use to format number values.
|
parse, print, setLenient
public NumberStyleFormatter()
public NumberStyleFormatter(String pattern)
pattern
- the format patternsetPattern(java.lang.String)
public void setPattern(String pattern)
DecimalFormat.applyPattern(String)
public NumberFormat getNumberFormat(Locale locale)
AbstractNumberFormatter
getNumberFormat
in class AbstractNumberFormatter
locale
- the current localenull
)