Class ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo
- java.lang.Object
-
- com.ibm.icu.text.CurrencyDisplayNames
-
- com.ibm.icu.impl.CurrencyData.CurrencyDisplayInfo
-
- com.ibm.icu.impl.ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo
-
- Enclosing class:
- ICUCurrencyDisplayInfoProvider
static class ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo extends CurrencyData.CurrencyDisplayInfo
This class performs data loading for currencies and keeps data in lightweight cache.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.CurrencySink
(package private) static class
ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.FormattingData
(package private) static class
ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.ParsingData
(package private) static class
ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.VariantSymbol
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
fallback
private ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.FormattingData
formattingDataCache
Single-item cache for getName(), getSymbol(), and getFormatInfo().(package private) ULocale
locale
private java.lang.ref.SoftReference<ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.ParsingData>
parsingDataCache
Cache for symbolMap() and nameMap().private java.lang.String[]
pluralsDataCache
Single-item cache for getPluralName().private ICUResourceBundle
rb
private CurrencyData.CurrencySpacingInfo
spacingInfoCache
Cache for getSpacingInfo().private java.util.Map<java.lang.String,java.lang.String>
unitPatternsCache
Cache for getUnitPatterns().private ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.VariantSymbol
variantSymbolCache
Single-item cache for variant symbols.
-
Constructor Summary
Constructors Constructor Description ICUCurrencyDisplayInfo(ULocale locale, ICUResourceBundle rb, boolean fallback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.FormattingData
fetchFormattingData(java.lang.String isoCode)
(package private) ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.ParsingData
fetchParsingData()
(package private) java.lang.String[]
fetchPluralsData(java.lang.String isoCode)
(package private) CurrencyData.CurrencySpacingInfo
fetchSpacingInfo()
(package private) java.util.Map<java.lang.String,java.lang.String>
fetchUnitPatterns()
(package private) ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.VariantSymbol
fetchVariantSymbol(java.lang.String isoCode, java.lang.String variant)
java.lang.String
getFormalSymbol(java.lang.String isoCode)
Returns the formal symbol for the currency with the provided ISO code.CurrencyData.CurrencyFormatInfo
getFormatInfo(java.lang.String isoCode)
java.lang.String
getName(java.lang.String isoCode)
Returns the 'long name' for the currency with the provided ISO code.java.lang.String
getNarrowSymbol(java.lang.String isoCode)
Returns the narrow symbol for the currency with the provided ISO code.java.lang.String
getPluralName(java.lang.String isoCode, java.lang.String pluralKey)
Returns a 'plural name' for the currency with the provided ISO code corresponding to the pluralKey.CurrencyData.CurrencySpacingInfo
getSpacingInfo()
java.lang.String
getSymbol(java.lang.String isoCode)
Returns the symbol for the currency with the provided ISO code.ULocale
getULocale()
Returns the locale used to determine how to translate the currency names.java.util.Map<java.lang.String,java.lang.String>
getUnitPatterns()
java.lang.String
getVariantSymbol(java.lang.String isoCode)
Returns the variant symbol for the currency with the provided ISO code.java.util.Map<java.lang.String,java.lang.String>
nameMap()
Returns a mapping from localized names (standard and plural) to currency codes.java.util.Map<java.lang.String,java.lang.String>
symbolMap()
Returns a mapping from localized symbols and currency codes to currency codes.-
Methods inherited from class com.ibm.icu.text.CurrencyDisplayNames
getInstance, getInstance, getInstance, getInstance, hasData
-
-
-
-
Field Detail
-
locale
final ULocale locale
-
fallback
final boolean fallback
-
rb
private final ICUResourceBundle rb
-
formattingDataCache
private volatile ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.FormattingData formattingDataCache
Single-item cache for getName(), getSymbol(), and getFormatInfo(). Holds data for only one currency. If another currency is requested, the old cache item is overwritten.
-
variantSymbolCache
private volatile ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.VariantSymbol variantSymbolCache
Single-item cache for variant symbols. Holds data for only one currency. If another currency is requested, the old cache item is overwritten.
-
pluralsDataCache
private volatile java.lang.String[] pluralsDataCache
Single-item cache for getPluralName().array[0] is the ISO code.
array[1+p] is the plural name where p=standardPlural.ordinal().Holds data for only one currency. If another currency is requested, the old cache item is overwritten.
-
parsingDataCache
private volatile java.lang.ref.SoftReference<ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.ParsingData> parsingDataCache
Cache for symbolMap() and nameMap().
-
unitPatternsCache
private volatile java.util.Map<java.lang.String,java.lang.String> unitPatternsCache
Cache for getUnitPatterns().
-
spacingInfoCache
private volatile CurrencyData.CurrencySpacingInfo spacingInfoCache
Cache for getSpacingInfo().
-
-
Constructor Detail
-
ICUCurrencyDisplayInfo
public ICUCurrencyDisplayInfo(ULocale locale, ICUResourceBundle rb, boolean fallback)
-
-
Method Detail
-
getULocale
public ULocale getULocale()
Description copied from class:CurrencyDisplayNames
Returns the locale used to determine how to translate the currency names. This is not necessarily the same locale passed toCurrencyDisplayNames.getInstance(ULocale)
.- Specified by:
getULocale
in classCurrencyDisplayNames
- Returns:
- the display locale
-
getName
public java.lang.String getName(java.lang.String isoCode)
Description copied from class:CurrencyDisplayNames
Returns the 'long name' for the currency with the provided ISO code. If there is no data for the ISO code, substitutes isoCode, or returns null if noSubstitute was set in the factory method.- Specified by:
getName
in classCurrencyDisplayNames
- Parameters:
isoCode
- the three-letter ISO code- Returns:
- the display name
-
getSymbol
public java.lang.String getSymbol(java.lang.String isoCode)
Description copied from class:CurrencyDisplayNames
Returns the symbol for the currency with the provided ISO code.If there is no data for this symbol, substitutes isoCode, or returns null if noSubstitute was set in the factory method.
- Specified by:
getSymbol
in classCurrencyDisplayNames
- Parameters:
isoCode
- the three-letter ISO code.- Returns:
- the symbol.
-
getNarrowSymbol
public java.lang.String getNarrowSymbol(java.lang.String isoCode)
Description copied from class:CurrencyDisplayNames
Returns the narrow symbol for the currency with the provided ISO code.The narrow currency symbol is similar to the regular currency symbol, but it always takes the shortest form; for example, "$" instead of "US$" for USD in en-CA.
If there is no data for this symbol, substitutes the default symbol, or returns null if noSubstitute was set in the factory method.
- Specified by:
getNarrowSymbol
in classCurrencyDisplayNames
- Parameters:
isoCode
- the three-letter ISO code.- Returns:
- the narrow symbol.
-
getFormalSymbol
public java.lang.String getFormalSymbol(java.lang.String isoCode)
Description copied from class:CurrencyDisplayNames
Returns the formal symbol for the currency with the provided ISO code.The formal currency symbol is similar to the regular currency symbol, but it always takes the form used in formal settings such as banking; for example, "NT$" instead of "$" for TWD in zh-TW.
If there is no data for this symbol, substitutes the default symbol, or returns null if noSubstitute was set in the factory method.
- Specified by:
getFormalSymbol
in classCurrencyDisplayNames
- Parameters:
isoCode
- the three-letter ISO code.- Returns:
- the formal symbol.
-
getVariantSymbol
public java.lang.String getVariantSymbol(java.lang.String isoCode)
Description copied from class:CurrencyDisplayNames
Returns the variant symbol for the currency with the provided ISO code.The variant symbol for a currency is an alternative symbol that is not necessarily as widely used as the regular symbol.
If there is no data for variant symbol, substitutes the default symbol, or returns null if noSubstitute was set in the factory method.
- Specified by:
getVariantSymbol
in classCurrencyDisplayNames
- Parameters:
isoCode
- the three-letter ISO code.- Returns:
- the variant symbol.
-
getPluralName
public java.lang.String getPluralName(java.lang.String isoCode, java.lang.String pluralKey)
Description copied from class:CurrencyDisplayNames
Returns a 'plural name' for the currency with the provided ISO code corresponding to the pluralKey. If there is no data for the ISO code, substitutes isoCode or returns null. If there is data for the ISO code but no data for the plural key, substitutes the 'other' value (and failing that the isoCode) or returns null.- Specified by:
getPluralName
in classCurrencyDisplayNames
- Parameters:
isoCode
- the three-letter ISO codepluralKey
- the plural key, for example "one", "other"- Returns:
- the display name
- See Also:
PluralRules
-
symbolMap
public java.util.Map<java.lang.String,java.lang.String> symbolMap()
Description copied from class:CurrencyDisplayNames
Returns a mapping from localized symbols and currency codes to currency codes. The returned map is unmodifiable.- Specified by:
symbolMap
in classCurrencyDisplayNames
- Returns:
- the map
-
nameMap
public java.util.Map<java.lang.String,java.lang.String> nameMap()
Description copied from class:CurrencyDisplayNames
Returns a mapping from localized names (standard and plural) to currency codes. The returned map is unmodifiable.- Specified by:
nameMap
in classCurrencyDisplayNames
- Returns:
- the map
-
getUnitPatterns
public java.util.Map<java.lang.String,java.lang.String> getUnitPatterns()
- Specified by:
getUnitPatterns
in classCurrencyData.CurrencyDisplayInfo
-
getFormatInfo
public CurrencyData.CurrencyFormatInfo getFormatInfo(java.lang.String isoCode)
- Specified by:
getFormatInfo
in classCurrencyData.CurrencyDisplayInfo
-
getSpacingInfo
public CurrencyData.CurrencySpacingInfo getSpacingInfo()
- Specified by:
getSpacingInfo
in classCurrencyData.CurrencyDisplayInfo
-
fetchFormattingData
ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.FormattingData fetchFormattingData(java.lang.String isoCode)
-
fetchVariantSymbol
ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.VariantSymbol fetchVariantSymbol(java.lang.String isoCode, java.lang.String variant)
-
fetchPluralsData
java.lang.String[] fetchPluralsData(java.lang.String isoCode)
-
fetchParsingData
ICUCurrencyDisplayInfoProvider.ICUCurrencyDisplayInfo.ParsingData fetchParsingData()
-
fetchUnitPatterns
java.util.Map<java.lang.String,java.lang.String> fetchUnitPatterns()
-
fetchSpacingInfo
CurrencyData.CurrencySpacingInfo fetchSpacingInfo()
-
-