Package com.ibm.icu.text
Class CurrencyPluralInfo
- java.lang.Object
-
- com.ibm.icu.text.CurrencyPluralInfo
-
- All Implemented Interfaces:
Serializable,Cloneable
public class CurrencyPluralInfo extends Object implements Cloneable, Serializable
This class represents the information needed by DecimalFormat to format currency plural, such as "3.00 US dollars" or "1.00 US dollar". DecimalFormat creates for itself an instance of CurrencyPluralInfo from its locale data. If you need to change any of these symbols, you can get the CurrencyPluralInfo object from your DecimalFormat and modify it. Following are the information needed for currency plural format and parse: locale information, plural rule of the locale, currency plural pattern of the locale.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CurrencyPluralInfo()Create a CurrencyPluralInfo object for the defaultFORMATlocale.CurrencyPluralInfo(ULocale locale)Create a CurrencyPluralInfo object for the given locale.CurrencyPluralInfo(Locale locale)Create a CurrencyPluralInfo object for the given locale.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Objectclone()Standard overridebooleanequals(Object a)Override equalsStringgetCurrencyPluralPattern(String pluralCount)Given a plural count, gets currency plural pattern of this locale, used for currency plural formatstatic CurrencyPluralInfogetInstance()Gets a CurrencyPluralInfo instance for the default locale.static CurrencyPluralInfogetInstance(ULocale locale)Gets a CurrencyPluralInfo instance for the given locale.static CurrencyPluralInfogetInstance(Locale locale)Gets a CurrencyPluralInfo instance for the given locale.ULocalegetLocale()Get localePluralRulesgetPluralRules()Gets plural rules of this locale, used for currency plural formatinthashCode()Deprecated.This API is ICU internal only.voidsetCurrencyPluralPattern(String pluralCount, String pattern)Set currency plural patterns.voidsetLocale(ULocale loc)Set locale.voidsetPluralRules(String ruleDescription)Set plural rules.
-
-
-
Constructor Detail
-
CurrencyPluralInfo
public CurrencyPluralInfo()
Create a CurrencyPluralInfo object for the defaultFORMATlocale.- See Also:
ULocale.Category.FORMAT
-
CurrencyPluralInfo
public CurrencyPluralInfo(Locale locale)
Create a CurrencyPluralInfo object for the given locale.- Parameters:
locale- the locale
-
CurrencyPluralInfo
public CurrencyPluralInfo(ULocale locale)
Create a CurrencyPluralInfo object for the given locale.- Parameters:
locale- the locale
-
-
Method Detail
-
getInstance
public static CurrencyPluralInfo getInstance()
Gets a CurrencyPluralInfo instance for the default locale.- Returns:
- A CurrencyPluralInfo instance.
-
getInstance
public static CurrencyPluralInfo getInstance(Locale locale)
Gets a CurrencyPluralInfo instance for the given locale.- Parameters:
locale- the locale.- Returns:
- A CurrencyPluralInfo instance.
-
getInstance
public static CurrencyPluralInfo getInstance(ULocale locale)
Gets a CurrencyPluralInfo instance for the given locale.- Parameters:
locale- the locale.- Returns:
- A CurrencyPluralInfo instance.
-
getPluralRules
public PluralRules getPluralRules()
Gets plural rules of this locale, used for currency plural format- Returns:
- plural rule
-
getCurrencyPluralPattern
public String getCurrencyPluralPattern(String pluralCount)
Given a plural count, gets currency plural pattern of this locale, used for currency plural format- Parameters:
pluralCount- currency plural count- Returns:
- a currency plural pattern based on plural count
-
getLocale
public ULocale getLocale()
Get locale- Returns:
- locale
-
setPluralRules
public void setPluralRules(String ruleDescription)
Set plural rules. These are initially set in the constructor based on the locale, and usually do not need to be changed.- Parameters:
ruleDescription- new plural rule description
-
setCurrencyPluralPattern
public void setCurrencyPluralPattern(String pluralCount, String pattern)
Set currency plural patterns. These are initially set in the constructor based on the locale, and usually do not need to be changed.- Parameters:
pluralCount- the plural count for which the currency pattern will be overridden.pattern- the new currency plural pattern
-
setLocale
public void setLocale(ULocale loc)
Set locale. This also sets both the plural rules and the currency plural patterns to be the defaults for the locale.- Parameters:
loc- the new locale to set
-
clone
public Object clone()
Standard override
-
equals
public boolean equals(Object a)
Override equals- Overrides:
equalsin classObject- Parameters:
a- the object to compare this instance with.- Returns:
trueif the specified object is equal to thisObject;falseotherwise.- See Also:
Object.hashCode()
-
hashCode
@Deprecated public int hashCode()
Deprecated.This API is ICU internal only.Mock implementation of hashCode(). This implementation always returns a constant value. When Java assertion is enabled, this method triggers an assertion failure.- Overrides:
hashCodein classObject- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
-