APIdia Launch Partner
Top Description Fields Constructors Methods
sun.util.locale.provider

public Class CurrencyNameProviderImpl

extends CurrencyNameProvider
implements AvailableLanguageTags
Class Inheritance
All Implemented Interfaces
sun.util.locale.provider.AvailableLanguageTags
Imports
java.util.Locale, .Set, java.util.spi.CurrencyNameProvider

Concrete implementation of the CurrencyNameProvider class for the JRE LocaleProviderAdapter.
Authors
Naoto Sato, Masayoshi Okutsu

Field Summary

Modifier and TypeField and Description
private final Set<String>
private final LocaleProviderAdapter.Type

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Set<String>
getAvailableLanguageTags()

Implements sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Returns a set of available language tags of a LocaleServiceProvider.

public Locale[]

Returns:

An array of all locales for which this locale service provider can provide localized objects or names.
getAvailableLocales
()

Implements abstract java.util.spi.LocaleServiceProvider.getAvailableLocales.

Returns an array of all locales for which this locale service provider can provide localized objects or names.

public String

Returns:

the name for the currency that is appropriate for display to the user, or null if the name is not available for the locale
getDisplayName
(String
the ISO 4217 currency code, which consists of three upper-case letters between 'A' (U+0041) and 'Z' (U+005A)
currencyCode
,
Locale
the desired locale
locale
)

Overrides java.util.spi.CurrencyNameProvider.getDisplayName.

Returns a name for the currency that is appropriate for display to the user.

private String
getString(String key, Locale locale)

public String

Returns:

the symbol of the given currency code for the specified locale, or null if the symbol is not available for the locale
getSymbol
(String
the ISO 4217 currency code, which consists of three upper-case letters between 'A' (U+0041) and 'Z' (U+005A)
currencyCode
,
Locale
the desired locale
locale
)

Implements abstract java.util.spi.CurrencyNameProvider.getSymbol.

Gets the symbol of the given currency code for the specified locale.

Field Detail

langtagsback to summary
private final Set<String> langtags
typeback to summary
private final LocaleProviderAdapter.Type type

Constructor Detail

CurrencyNameProviderImplback to summary
public CurrencyNameProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags)

Method Detail

getAvailableLanguageTagsback to summary
public Set<String> getAvailableLanguageTags()

Implements sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Doc from sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Returns a set of available language tags of a LocaleServiceProvider. Note that the returned set doesn't contain the language tag for Locale.Root.

Annotations
@Override
getAvailableLocalesback to summary
public Locale[] getAvailableLocales()

Implements abstract java.util.spi.LocaleServiceProvider.getAvailableLocales.

Returns an array of all locales for which this locale service provider can provide localized objects or names.

Returns:Locale[]

An array of all locales for which this locale service provider can provide localized objects or names.

Annotations
@Override
getDisplayNameback to summary
public String getDisplayName(String currencyCode, Locale locale)

Overrides java.util.spi.CurrencyNameProvider.getDisplayName.

Returns a name for the currency that is appropriate for display to the user. The default implementation returns null.

Parameters
currencyCode:String

the ISO 4217 currency code, which consists of three upper-case letters between 'A' (U+0041) and 'Z' (U+005A)

locale:Locale

the desired locale

Returns:String

the name for the currency that is appropriate for display to the user, or null if the name is not available for the locale

Annotations
@Override
Exceptions
IllegalArgumentException:
if currencyCode is not in the form of three upper-case letters, or locale isn't one of the locales returned from getAvailableLocales().
NullPointerException:
if currencyCode or locale is null
Since
1.7
getStringback to summary
private String getString(String key, Locale locale)
getSymbolback to summary
public String getSymbol(String currencyCode, Locale locale)

Implements abstract java.util.spi.CurrencyNameProvider.getSymbol.

Gets the symbol of the given currency code for the specified locale. For example, for "USD" (US Dollar), the symbol is "$" if the specified locale is the US, while for other locales it may be "US$". If no symbol can be determined, null should be returned.

Parameters
currencyCode:String

the ISO 4217 currency code, which consists of three upper-case letters between 'A' (U+0041) and 'Z' (U+005A)

locale:Locale

the desired locale

Returns:String

the symbol of the given currency code for the specified locale, or null if the symbol is not available for the locale

Annotations
@Override
Exceptions
NullPointerException:
if currencyCode or locale is null
IllegalArgumentException:
if currencyCode is not in the form of three upper-case letters, or locale isn't one of the locales returned from getAvailableLocales().
See Also
java.util.Currency#getSymbol(java.util.Locale)