Class LongNameHandler
java.lang.Object
org.graalvm.shadowed.com.ibm.icu.impl.number.LongNameHandler
- All Implemented Interfaces:
LongNameMultiplexer.ParentlessMicroPropsGenerator, MicroPropsGenerator, ModifierStore
public class LongNameHandler
extends Object
implements MicroPropsGenerator, ModifierStore, LongNameMultiplexer.ParentlessMicroPropsGenerator
Takes care of formatting currency and measurement unit names, as well as populating the gender of measure units.
-
Method Summary
Modifier and TypeMethodDescriptionstatic LongNameHandlerforCurrencyLongNames(ULocale locale, Currency currency, PluralRules rules, MicroPropsGenerator parent) static LongNameHandlerforMeasureUnit(ULocale locale, MeasureUnit unit, NumberFormatter.UnitWidth width, String unitDisplayCase, PluralRules rules, MicroPropsGenerator parent) Construct a localized LongNameHandler for the specified MeasureUnit.getModifier(Modifier.Signum signum, StandardPlural plural) Returns a Modifier with the given parameters (best-effort).static StringgetUnitDisplayName(ULocale locale, MeasureUnit unit, NumberFormatter.UnitWidth width) processQuantity(DecimalQuantity quantity) Considers the givenDecimalQuantity, optionally mutates it, and returns aMicroProps.processQuantityWithMicros(DecimalQuantity quantity, MicroProps micros) Produces a plural-appropriate Modifier for a unit:quantityis taken as the final smallest unit, while the larger unit values must be provided viamicros.mixedMeasures.
-
Method Details
-
getUnitDisplayName
public static String getUnitDisplayName(ULocale locale, MeasureUnit unit, NumberFormatter.UnitWidth width) -
forCurrencyLongNames
public static LongNameHandler forCurrencyLongNames(ULocale locale, Currency currency, PluralRules rules, MicroPropsGenerator parent) -
forMeasureUnit
public static LongNameHandler forMeasureUnit(ULocale locale, MeasureUnit unit, NumberFormatter.UnitWidth width, String unitDisplayCase, PluralRules rules, MicroPropsGenerator parent) Construct a localized LongNameHandler for the specified MeasureUnit.Mixed units are not supported, use MixedUnitLongNameHandler.forMeasureUnit.
- Parameters:
locale- The desired locale.unit- The measure unit to construct a LongNameHandler for.width- Specifies the desired unit rendering.unitDisplayCase- Specifies the desired grammatical case. If the specified case is not found, we fall back to nominative or no-case.rules- Plural rules.parent- Plural rules.
-
processQuantity
Description copied from interface:MicroPropsGeneratorConsiders the givenDecimalQuantity, optionally mutates it, and returns aMicroProps.- Specified by:
processQuantityin interfaceMicroPropsGenerator- Parameters:
quantity- The quantity for consideration and optional mutation.- Returns:
- A MicroProps instance resolved for the quantity.
-
processQuantityWithMicros
Produces a plural-appropriate Modifier for a unit:quantityis taken as the final smallest unit, while the larger unit values must be provided viamicros.mixedMeasures. Does not call parent.processQuantity, so cannot get a MicroProps instance that way. Instead, the instance is passed in as a parameter.- Specified by:
processQuantityWithMicrosin interfaceLongNameMultiplexer.ParentlessMicroPropsGenerator
-
getModifier
Description copied from interface:ModifierStoreReturns a Modifier with the given parameters (best-effort).- Specified by:
getModifierin interfaceModifierStore
-