|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.format.number.AbstractNumberFormatter
org.springframework.format.number.CurrencyFormatter
public class CurrencyFormatter
A BigDecimal formatter for currency values.
Delegates to NumberFormat.getCurrencyInstance(Locale).
Configures BigDecimal parsing so there is no loss of precision.
Can apply a specified RoundingMode to parsed values.
AbstractNumberFormatter.setLenient(boolean),
setRoundingMode(java.math.RoundingMode)| Constructor Summary | |
|---|---|
CurrencyFormatter()
|
|
| Method Summary | |
|---|---|
protected NumberFormat |
getNumberFormat(Locale locale)
Obtain a concrete NumberFormat for the specified locale. |
BigDecimal |
parse(String text,
Locale locale)
Parse a text String to produce a T. |
void |
setCurrency(Currency currency)
Specify the currency, if known. |
void |
setFractionDigits(int fractionDigits)
Specify the desired number of fraction digits. |
void |
setRoundingMode(RoundingMode roundingMode)
Specify the rounding mode to use for decimal parsing. |
| Methods inherited from class org.springframework.format.number.AbstractNumberFormatter |
|---|
print, setLenient |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CurrencyFormatter()
| Method Detail |
|---|
public void setFractionDigits(int fractionDigits)
public void setRoundingMode(RoundingMode roundingMode)
RoundingMode.UNNECESSARY.
public void setCurrency(Currency currency)
public BigDecimal parse(String text,
Locale locale)
throws ParseException
Parser
parse in interface Parser<Number>parse in class AbstractNumberFormattertext - the text stringlocale - the current user locale
ParseException - when a parse exception occurs in a java.text parsing libraryprotected NumberFormat getNumberFormat(Locale locale)
AbstractNumberFormatter
getNumberFormat in class AbstractNumberFormatterlocale - the current locale
null)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||