类 CurrencyStyleFormatter
java.lang.Object
cn.taketoday.format.number.AbstractNumberFormatter
cn.taketoday.format.number.CurrencyStyleFormatter
A BigDecimal formatter for number values in currency style.
Delegates to NumberFormat.getCurrencyInstance(Locale).
Configures BigDecimal parsing so there is no loss of precision.
Can apply a specified RoundingMode to parsed values.
- 从以下版本开始:
- 4.0
- 作者:
- Keith Donald, Juergen Hoeller
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected NumberFormatgetNumberFormat(Locale locale) Obtain a concrete NumberFormat for the specified locale.Parse a text String to produce a T.voidsetCurrency(Currency currency) Specify the currency, if known.voidsetFractionDigits(int fractionDigits) Specify the desired number of fraction digits.voidsetPattern(String pattern) Specify the pattern to use to format number values.voidsetRoundingMode(RoundingMode roundingMode) Specify the rounding mode to use for decimal parsing.从类继承的方法 cn.taketoday.format.number.AbstractNumberFormatter
print, setLenient
-
构造器详细资料
-
CurrencyStyleFormatter
public CurrencyStyleFormatter()
-
-
方法详细资料
-
setFractionDigits
public void setFractionDigits(int fractionDigits) Specify the desired number of fraction digits. Default is 2. -
setRoundingMode
Specify the rounding mode to use for decimal parsing. Default isRoundingMode.UNNECESSARY. -
setCurrency
Specify the currency, if known. -
setPattern
Specify the pattern to use to format number values. If not specified, the default DecimalFormat pattern is used. -
parse
从接口复制的说明:ParserParse a text String to produce a T.- 指定者:
parse在接口中Parser<Number>- 覆盖:
parse在类中AbstractNumberFormatter- 参数:
text- the text stringlocale- the current user locale- 返回:
- an instance of T
- 抛出:
ParseException- when a parse exception occurs in a java.text parsing library
-
getNumberFormat
从类复制的说明:AbstractNumberFormatterObtain a concrete NumberFormat for the specified locale.- 指定者:
getNumberFormat在类中AbstractNumberFormatter- 参数:
locale- the current locale- 返回:
- the NumberFormat instance (never
null)
-