Class PluralOperands.Builder
- Enclosing class:
PluralOperands
PluralOperands.- Since:
- 3.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds immutable plural operands.compactExponent(@Nullable Integer compactExponent) Specifies the compact-decimal exponent used by the CLDRcandeoperands.runtimeLimits(@Nullable TranslationRuntimeLimits runtimeLimits) Applies safety limits to operand construction.visibleDecimalPlaces(@Nullable Integer visibleDecimalPlaces) Specifies the number of decimal places that will be visible to the user.
-
Method Details
-
visibleDecimalPlaces
Specifies the number of decimal places that will be visible to the user.If omitted,
BigDecimalscale is preserved and otherNumbertypes use their normalized decimal places. Reducing the scale does not round implicitly: callers must supply an already-rounded number, otherwisebuild()throwsArithmeticException. The activeTranslationRuntimeLimitsdetermine the accepted maximum; the library default isTranslationRuntimeLimits.DEFAULT_MAXIMUM_VISIBLE_DECIMAL_PLACESand the hard ceiling isPluralOperands.MAXIMUM_VISIBLE_DECIMAL_PLACES.- Parameters:
visibleDecimalPlaces- the visible decimal places, from zero through the active runtime limit, or null to use the number's natural scale- Returns:
- this builder, not null
-
compactExponent
Specifies the compact-decimal exponent used by the CLDRcandeoperands.The number supplied to this builder is the displayed mantissa, not the expanded value. For example, a compact display such as
1Mis represented by the number1and a compact exponent of6, not by the number1000000and an exponent of6. The activeTranslationRuntimeLimitsdetermine the accepted maximum; the library default isTranslationRuntimeLimits.DEFAULT_MAXIMUM_COMPACT_EXPONENTand the hard ceiling isPluralOperands.MAXIMUM_COMPACT_EXPONENT.- Parameters:
compactExponent- the compact-decimal exponent, from zero through the active runtime limit, or null to use zero- Returns:
- this builder, not null
-
runtimeLimits
public @NonNull PluralOperands.Builder runtimeLimits(@Nullable TranslationRuntimeLimits runtimeLimits) Applies safety limits to operand construction.- Parameters:
runtimeLimits- runtime limits, or null to use the library defaults- Returns:
- this builder, not null
- Since:
- 3.0.0
-
build
Builds immutable plural operands.- Returns:
- immutable plural operands, not null
- Throws:
ArithmeticException- if the requested visible decimal places would require roundingIllegalArgumentException- if the number implementation is unsupported, the number is non-finite, or the number, visible decimal places, or compact exponent exceeds a supported safety limit
-