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

public Class TimeZoneNameProviderImpl

extends TimeZoneNameProvider
Class Inheritance
Known Direct Subclasses
sun.util.cldr.CLDRTimeZoneNameProviderImpl
Imports
java.util.Locale, .Objects, .Set, .TimeZone, java.util.spi.TimeZoneNameProvider

Concrete implementation of the TimeZoneNameProvider 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
protected

Method Summary

Modifier and TypeMethod and Description
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 human-readable name of the given time zone in the given locale, or null if it's not available.
getDisplayName
(String
a time zone ID string
id
,
boolean
if true, return the daylight saving name.
daylight
,
int style, Locale
the desired locale
locale
)

Implements abstract java.util.spi.TimeZoneNameProvider.getDisplayName.

Returns a name for the given time zone ID that's suitable for presentation to the user in the specified locale.

protected String[]
public String
getGenericDisplayName(String id, int style, Locale locale)

Overrides java.util.spi.TimeZoneNameProvider.getGenericDisplayName.

Returns a generic name for the given time zone ID that's suitable for presentation to the user in the specified locale.

protected String[][]

Returns:

an array of time zone names arrays
getZoneStrings
(Locale
a Locale for time zone names
locale
)

Returns a String[][] as the DateFormatSymbols.getZoneStrings() value for the given locale.

public boolean
isSupportedLocale(Locale locale)

Overrides java.util.spi.LocaleServiceProvider.isSupportedLocale.

Returns true if the given locale is supported by this locale service provider.

Field Detail

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

Constructor Detail

TimeZoneNameProviderImplback to summary
protected TimeZoneNameProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags)

Method Detail

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 id, boolean daylight, int style, Locale locale)

Implements abstract java.util.spi.TimeZoneNameProvider.getDisplayName.

Returns a name for the given time zone ID that's suitable for presentation to the user in the specified locale. The given time zone ID is "GMT" or one of the names defined using "Zone" entries in the "tz database", a public domain time zone database at ftp://elsie.nci.nih.gov/pub/. The data of this database is contained in a file whose name starts with "tzdata", and the specification of the data format is part of the zic.8 man page, which is contained in a file whose name starts with "tzcode".

If daylight is true, the method should return a name appropriate for daylight saving time even if the specified time zone has not observed daylight saving time in the past.

Parameters
id:String

a time zone ID string

daylight:boolean

if true, return the daylight saving name.

style:int

either TimeZone.LONG or TimeZone.SHORT

locale:Locale

the desired locale

Returns:String

the human-readable name of the given time zone in the given locale, or null if it's not available.

Annotations
@Override
Exceptions
IllegalArgumentException:
if style is invalid, or locale isn't one of the locales returned from getAvailableLocales().
NullPointerException:
if ID or locale is null
See Also
java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
getDisplayNameArrayback to summary
protected String[] getDisplayNameArray(String id, Locale locale)
getGenericDisplayNameback to summary
public String getGenericDisplayName(String id, int style, Locale locale)

Overrides java.util.spi.TimeZoneNameProvider.getGenericDisplayName.

Doc from java.util.spi.TimeZoneNameProvider.getGenericDisplayName.

Returns a generic name for the given time zone ID that's suitable for presentation to the user in the specified locale. Generic time zone names are neutral from standard time and daylight saving time. For example, "PT" is the short generic name of time zone ID America/Los_Angeles, while its short standard time and daylight saving time names are "PST" and "PDT", respectively. Refer to getDisplayName for valid time zone IDs.

The default implementation of this method returns null.

Annotations
@Override
getZoneStringsback to summary
protected String[][] getZoneStrings(Locale locale)

Returns a String[][] as the DateFormatSymbols.getZoneStrings() value for the given locale.

Parameters
locale:Locale

a Locale for time zone names

Returns:String[][]

an array of time zone names arrays

isSupportedLocaleback to summary
public boolean isSupportedLocale(Locale locale)

Overrides java.util.spi.LocaleServiceProvider.isSupportedLocale.

Doc from java.util.spi.LocaleServiceProvider.isSupportedLocale.

Returns true if the given locale is supported by this locale service provider. The given locale may contain extensions that should be taken into account for the support determination.

The default implementation returns true if the given locale is equal to any of the available Locales returned by getAvailableLocales() with ignoring any extensions in both the given locale and the available locales. Concrete locale service provider implementations should override this method if those implementations are Locale extensions-aware. For example, DecimalFormatSymbolsProvider implementations will need to check extensions in the given locale to see if any numbering system is specified and can be supported. However, CollatorProvider implementations may not be affected by any particular numbering systems, and in that case, extensions for numbering systems should be ignored.

Annotations
@Override