Class MonetaryAmountFormatter
java.lang.Object
org.springframework.format.number.money.MonetaryAmountFormatter
- All Implemented Interfaces:
- Formatter<javax.money.MonetaryAmount>,- Parser<javax.money.MonetaryAmount>,- Printer<javax.money.MonetaryAmount>
public class MonetaryAmountFormatter
extends Object
implements Formatter<javax.money.MonetaryAmount>
Formatter for JSR-354 
MonetaryAmount values,
 delegating to MonetaryAmountFormat.format(javax.money.MonetaryAmount)
 and MonetaryAmountFormat.parse(java.lang.CharSequence).- Since:
- 4.2
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a locale-driven MonetaryAmountFormatter.MonetaryAmountFormatter(String formatName) Create a new MonetaryAmountFormatter for the given format name.
- 
Method SummaryModifier and TypeMethodDescriptionprotected javax.money.format.MonetaryAmountFormatgetMonetaryAmountFormat(Locale locale) Obtain a MonetaryAmountFormat for the given locale.javax.money.MonetaryAmountParse a text String to produce a T.Print the object of type T for display.voidsetFormatName(String formatName) Specify the format name, to be resolved by the JSR-354 provider at runtime.
- 
Constructor Details- 
MonetaryAmountFormatterpublic MonetaryAmountFormatter()Create a locale-driven MonetaryAmountFormatter.
- 
MonetaryAmountFormatterCreate a new MonetaryAmountFormatter for the given format name.- Parameters:
- formatName- the format name, to be resolved by the JSR-354 provider at runtime
 
 
- 
- 
Method Details- 
setFormatNameSpecify the format name, to be resolved by the JSR-354 provider at runtime.Default is none, obtaining a MonetaryAmountFormatbased on the current locale.
- 
printDescription copied from interface:PrinterPrint the object of type T for display.
- 
parseDescription copied from interface:ParserParse a text String to produce a T.
- 
getMonetaryAmountFormatObtain a MonetaryAmountFormat for the given locale.The default implementation simply calls MonetaryFormats.getAmountFormat(java.util.Locale, java.lang.String...)with either the configured format name or the given locale.- Parameters:
- locale- the current locale
- Returns:
- the MonetaryAmountFormat (never null)
- See Also:
 
 
-