Class NumberStyleFormatter
java.lang.Object
org.springframework.format.number.AbstractNumberFormatter
org.springframework.format.number.NumberStyleFormatter
A general-purpose number formatter using NumberFormat's number style.
 
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.
- Since:
- 4.2
- Author:
- Keith Donald, Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new NumberStyleFormatter without a pattern.NumberStyleFormatter(String pattern) Create a new NumberStyleFormatter with the specified pattern.
- 
Method SummaryModifier and TypeMethodDescriptiongetNumberFormat(Locale locale) Obtain a concrete NumberFormat for the specified locale.voidsetPattern(String pattern) Specify the pattern to use to format number values.Methods inherited from class org.springframework.format.number.AbstractNumberFormatterparse, print, setLenient
- 
Constructor Details- 
NumberStyleFormatterpublic NumberStyleFormatter()Create a new NumberStyleFormatter without a pattern.
- 
NumberStyleFormatterCreate a new NumberStyleFormatter with the specified pattern.- Parameters:
- pattern- the format pattern
- See Also:
 
 
- 
- 
Method Details- 
setPatternSpecify the pattern to use to format number values. If not specified, the default DecimalFormat pattern is used.- See Also:
 
- 
getNumberFormatDescription copied from class:AbstractNumberFormatterObtain a concrete NumberFormat for the specified locale.- Specified by:
- getNumberFormatin class- AbstractNumberFormatter
- Parameters:
- locale- the current locale
- Returns:
- the NumberFormat instance (never null)
 
 
-