Class CurrencyPrecision
java.lang.Object
com.ibm.icu.number.Precision
com.ibm.icu.number.CurrencyPrecision
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.
- See Also:
- Status:
- Stable ICU 60.
-
Nested Class Summary
Nested classes/interfaces inherited from class Precision
Precision.BogusRounderModifier and TypeClassDescriptionstatic classDeprecated.This API is ICU internal only. -
Field Summary
Fields inherited from class Precision
BOGUS_PRECISIONModifier and TypeFieldDescriptionstatic final Precision.BogusRounderDeprecated.ICU internal only. -
Method Summary
Modifier and TypeMethodDescriptionwithCurrency(Currency currency) Associates a currency with this rounding strategy.Methods inherited from class Precision
apply, currency, fixedFraction, fixedSignificantDigits, increment, integer, maxFraction, maxSignificantDigits, minFraction, minMaxFraction, minMaxSignificantDigits, minSignificantDigits, trailingZeroDisplay, unlimited, withModeModifier and TypeMethodDescriptionabstract voidapply(com.ibm.icu.impl.number.DecimalQuantity value) Deprecated.ICU 60 This API is ICU internal only.static CurrencyPrecisioncurrency(Currency.CurrencyUsage currencyUsage) Show numbers rounded and padded according to the rules for the currency unit.static FractionPrecisionfixedFraction(int minMaxFractionPlaces) Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).static PrecisionfixedSignificantDigits(int minMaxSignificantDigits) Show numbers rounded if necessary to a certain number of significant digits or significant figures.static Precisionincrement(BigDecimal roundingIncrement) Show numbers rounded if necessary to the closest multiple of a certain rounding increment.static FractionPrecisioninteger()Show numbers rounded if necessary to the nearest integer.static FractionPrecisionmaxFraction(int maxFractionPlaces) Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator).static PrecisionmaxSignificantDigits(int maxSignificantDigits) Show numbers rounded if necessary to a certain number of significant digits/figures.static FractionPrecisionminFraction(int minFractionPlaces) Always show at least a certain number of fraction places after the decimal separator, padding with zeros if necessary.static FractionPrecisionminMaxFraction(int minFractionPlaces, int maxFractionPlaces) Show numbers rounded if necessary to a certain number of fraction places (numerals after the decimal separator); in addition, always show at least a certain number of places after the decimal separator, padding with zeros if necessary.static PrecisionminMaxSignificantDigits(int minSignificantDigits, int maxSignificantDigits) Show numbers rounded if necessary to a certain number of significant digits/figures; in addition, always show at least a certain number of significant digits, padding with zeros if necessary.static PrecisionminSignificantDigits(int minSignificantDigits) Always show at least a certain number of significant digits/figures, padding with zeros if necessary.trailingZeroDisplay(NumberFormatter.TrailingZeroDisplay trailingZeroDisplay) Configure how trailing zeros are displayed on numbers.static PrecisionShow all available digits to full precision.withMode(MathContext mathContext) Deprecated.This API is ICU internal only.
-
Method Details
-
withCurrency
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- The currency to associate with this rounding strategy.- Returns:
- A Precision for chaining or passing to the NumberFormatter rounding() setter.
- Throws:
IllegalArgumentException- for null Currency- See Also:
- Status:
- Stable ICU 60.
-