类 NumberStyleFormatter
- java.lang.Object
- org.springframework.format.number.AbstractNumberFormatter
- org.springframework.format.number.NumberStyleFormatter
- 直接已知子类:
NumberFormatter
public class NumberStyleFormatter extends AbstractNumberFormatter
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. TheAbstractNumberFormatter.parse(String, Locale)
routine always returns a BigDecimal.- 从以下版本开始:
- 4.2
- 作者:
- Keith Donald, Juergen Hoeller
- 另请参阅:
setPattern(java.lang.String)
,AbstractNumberFormatter.setLenient(boolean)
构造器概要
构造器 构造器 说明 NumberStyleFormatter()
Create a new NumberStyleFormatter without a pattern.NumberStyleFormatter(String pattern)
Create a new NumberStyleFormatter with the specified pattern.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 org.springframework.format.number.AbstractNumberFormatter
parse, print, setLenient
构造器详细资料
NumberStyleFormatter
public NumberStyleFormatter()
Create a new NumberStyleFormatter without a pattern.
NumberStyleFormatter
public NumberStyleFormatter(String pattern)
Create a new NumberStyleFormatter with the specified pattern.- 参数:
pattern
- the format pattern- 另请参阅:
setPattern(java.lang.String)
方法详细资料
setPattern
public void setPattern(String pattern)
Specify the pattern to use to format number values. If not specified, the default DecimalFormat pattern is used.
getNumberFormat
public NumberFormat getNumberFormat(Locale locale)
从类复制的说明:AbstractNumberFormatter
Obtain a concrete NumberFormat for the specified locale.- 指定者:
getNumberFormat
在类中AbstractNumberFormatter
- 参数:
locale
- the current locale- 返回:
- the NumberFormat instance (never
null
)