Package com.ibm.icu.impl
Class PluralRulesLoader
- java.lang.Object
-
- com.ibm.icu.text.PluralRules.Factory
-
- com.ibm.icu.impl.PluralRulesLoader
-
public class PluralRulesLoader extends PluralRules.Factory
Loader for plural rules data.
-
-
Field Summary
Fields Modifier and Type Field Description static PluralRulesLoaderloaderThe only instance of the loader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PluralRulesforLocale(ULocale locale, PluralRules.PluralType type)Returns the plural rules for the the locale.ULocale[]getAvailableULocales()Returns the locales for which we have plurals data.ULocalegetFunctionalEquivalent(ULocale locale, boolean[] isAvailable)Returns the functionally equivalent locale.UResourceBundlegetPluralBundle()Return the plurals resource.PluralRangesgetPluralRanges(ULocale locale)PluralRulesgetRulesForRulesId(String rulesId)Gets the rule from the rulesId.StringgetRulesIdForLocale(ULocale locale, PluralRules.PluralType type)Gets the rulesId from the locale,with locale fallback.booleanhasOverride(ULocale locale)Returns whether or not there are overrides.booleanisPluralRangesAvailable(ULocale locale)-
Methods inherited from class com.ibm.icu.text.PluralRules.Factory
forLocale, getDefaultFactory
-
-
-
-
Field Detail
-
loader
public static final PluralRulesLoader loader
The only instance of the loader.
-
-
Method Detail
-
getAvailableULocales
public ULocale[] getAvailableULocales()
Returns the locales for which we have plurals data. Utility for testing.- Specified by:
getAvailableULocalesin classPluralRules.Factory
-
getFunctionalEquivalent
public ULocale getFunctionalEquivalent(ULocale locale, boolean[] isAvailable)
Returns the functionally equivalent locale.- Specified by:
getFunctionalEquivalentin classPluralRules.Factory- Parameters:
locale- the locale to checkisAvailable- if not null and of length > 0, this will hold 'true' at index 0 if locale is directly defined (without fallback) as having plural rules- Returns:
- the functionally-equivalent locale
-
getRulesIdForLocale
public String getRulesIdForLocale(ULocale locale, PluralRules.PluralType type)
Gets the rulesId from the locale,with locale fallback. If there is no rulesId, return null. The rulesId might be the empty string if the rule is the default rule.
-
getRulesForRulesId
public PluralRules getRulesForRulesId(String rulesId)
Gets the rule from the rulesId. If there is no rule for this rulesId, return null.
-
getPluralBundle
public UResourceBundle getPluralBundle() throws MissingResourceException
Return the plurals resource. Note MissingResourceException is unchecked, listed here for clarity. Callers should handle this exception.- Throws:
MissingResourceException
-
forLocale
public PluralRules forLocale(ULocale locale, PluralRules.PluralType type)
Returns the plural rules for the the locale. If we don't have data, com.ibm.icu.text.PluralRules.DEFAULT is returned.- Specified by:
forLocalein classPluralRules.Factory- Parameters:
locale- The locale for which aPluralRulesobject is returned.type- The plural type (e.g., cardinal or ordinal).- Returns:
- The predefined
PluralRulesobject for this locale. If there's no predefined rules for this locale, the rules for the closest parent in the locale hierarchy that has one will be returned. The final fallback always returns the default rules.
-
hasOverride
public boolean hasOverride(ULocale locale)
Description copied from class:PluralRules.FactoryReturns whether or not there are overrides.- Specified by:
hasOverridein classPluralRules.Factory
-
getPluralRanges
public PluralRanges getPluralRanges(ULocale locale)
-
isPluralRangesAvailable
public boolean isPluralRangesAvailable(ULocale locale)
-
-