Top Description Fields Constructors Methods
com.ibm.icu.number

public abstract Class CurrencyPrecision

extends Precision
Class Inheritance
Known Direct Subclasses
com.ibm.icu.number.Precision.CurrencyRounderImpl
Imports
com.ibm.icu.util.Currency

A class that defines a rounding strategy parameterized by a currency to be used when formatting numbers in NumberFormatter.

To create a CurrencyPrecision, use one of the factory methods on Precision.

ICU Status
Stable since ICU 60.
See Also
NumberFormatter

Field Summary

Inherited from com.ibm.icu.number.Precision:
BOGUS_PRECISIONCOMPACT_STRATEGYDEFAULT_MAX_FRAC_6FIXED_FRAC_0FIXED_FRAC_2FIXED_SIG_2FIXED_SIG_3mathContextMONETARY_CASHMONETARY_STANDARDNICKELNONERANGE_SIG_2_3trailingZeroDisplay

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Precision

Returns:

A Precision for chaining or passing to the NumberFormatter rounding() setter.
withCurrency
(Currency
The currency to associate with this rounding strategy.
currency
)

Associates a currency with this rounding strategy.

Inherited from com.ibm.icu.number.Precision:
applychooseMultiplierAndApplyconstructCurrencyconstructFractionconstructFractionSignificantconstructFromCurrencyconstructIncrementconstructInfiniteconstructSignificantcreateCopycreateCopyHelpercurrencyfixedFractionfixedSignificantDigitsincrementintegermaxFractionmaxSignificantDigitsminFractionminMaxFractionminMaxSignificantDigitsminSignificantDigitssetResolvedMinFractiontrailingZeroDisplayunlimitedwithLocaleDatawithMode

Constructor Detail

CurrencyPrecisionback to summary
pack-priv CurrencyPrecision()

Method Detail

withCurrencyback to summary
public Precision withCurrency(Currency currency)

Associates a currency with this rounding strategy.

Calling this method is not required, because the currency specified in unit() or via a CurrencyAmount passed into format(Measure) is automatically applied to currency rounding strategies. However, this method enables you to override that automatic association.

This method also enables numbers to be formatted using currency rounding rules without explicitly using a currency format.

Parameters
currency:Currency

The currency to associate with this rounding strategy.

Returns:Precision

A Precision for chaining or passing to the NumberFormatter rounding() setter.

Exceptions
IllegalArgumentException:
for null Currency
ICU Status
Stable since ICU 60.
See Also
NumberFormatter