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

public final Class TimeZoneNameUtility

extends Object
Class Inheritance
Imports
java.lang.ref.SoftReference, java.util.ArrayList, .List, .Locale, .Map, .Objects, .Optional, .Set, java.util.concurrent.ConcurrentHashMap, java.util.spi.TimeZoneNameProvider, sun.util.calendar.ZoneInfo, sun.util.cldr.CLDRLocaleProviderAdapter

Utility class that deals with the localized time zone names
Authors
Naoto Sato, Masayoshi Okutsu

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
TimeZoneNameUtility.TimeZoneNameGetter

Obtains a localized time zone strings from a TimeZoneNameProvider implementation.

Field Summary

Modifier and TypeField and Description
private static final Map<String, SoftReference<Map<Locale, String[]>>>
cachedDisplayNames

Cache for managing display names per timezone per locale The structure is: Map(key=id, value=SoftReference(Map(key=locale, value=displaynames)))

private static final ConcurrentHashMap<Locale, SoftReference<String[][]>>
cachedZoneData

cache to hold time zone localized strings.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Optional<String>
canonicalTZID(String id)

Returns the canonical ID for the given ID

public static Optional<String>

Returns:

the tzdb's time zone ID
convertLDMLShortID
(String
time zone short ID defined in LDML
shortID
)

Converts the time zone id from LDML's 5-letter id to tzdb's id

public static String

Returns:

the explicit metazone DST offset for the specified time zone ID, if exists
explicitDstOffset
(String
the time zone ID
tzid
)

Returns the explicit metazone DST offset for the specified time zone ID, if exists.

public static String[][]
getZoneStrings(Locale locale)

get time zone localized strings.

private static String[][]
public static String

Returns:

the requested time zone name, or null if not found.
retrieveDisplayName
(String
time zone ID
id
,
boolean
true for a daylight saving time name, or false for a standard time name
daylight
,
int
TimeZone.LONG or TimeZone.SHORT
style
,
Locale
desired Locale
locale
)

Retrieves a standard or daylight-saving time name for the given time zone ID.

public static String[]
retrieveDisplayNames(String id, Locale locale)

Retrieve display names for a time zone ID.

private static String[]
public static String

Returns:

the requested generic time zone display name, or null if not found.
retrieveGenericDisplayName
(String
time zone ID
id
,
int
TimeZone.LONG or TimeZone.SHORT
style
,
Locale
desired Locale
locale
)

Retrieves a generic time zone display name for a time zone ID.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedDisplayNamesback to summary
private static final Map<String, SoftReference<Map<Locale, String[]>>> cachedDisplayNames

Cache for managing display names per timezone per locale The structure is: Map(key=id, value=SoftReference(Map(key=locale, value=displaynames)))

cachedZoneDataback to summary
private static final ConcurrentHashMap<Locale, SoftReference<String[][]>> cachedZoneData

cache to hold time zone localized strings. Keyed by Locale

Constructor Detail

TimeZoneNameUtilityback to summary
private TimeZoneNameUtility()

Method Detail

canonicalTZIDback to summary
public static Optional<String> canonicalTZID(String id)

Returns the canonical ID for the given ID

convertLDMLShortIDback to summary
public static Optional<String> convertLDMLShortID(String shortID)

Converts the time zone id from LDML's 5-letter id to tzdb's id

Parameters
shortID:String

time zone short ID defined in LDML

Returns:Optional<String>

the tzdb's time zone ID

explicitDstOffsetback to summary
public static String explicitDstOffset(String tzid)

Returns the explicit metazone DST offset for the specified time zone ID, if exists.

Parameters
tzid:String

the time zone ID

Returns:String

the explicit metazone DST offset for the specified time zone ID, if exists

getZoneStringsback to summary
public static String[][] getZoneStrings(Locale locale)

get time zone localized strings. Enumerate all keys.

loadZoneStringsback to summary
private static String[][] loadZoneStrings(Locale locale)
retrieveDisplayNameback to summary
public static String retrieveDisplayName(String id, boolean daylight, int style, Locale locale)

Retrieves a standard or daylight-saving time name for the given time zone ID.

Parameters
id:String

time zone ID

daylight:boolean

true for a daylight saving time name, or false for a standard time name

style:int

TimeZone.LONG or TimeZone.SHORT

locale:Locale

desired Locale

Returns:String

the requested time zone name, or null if not found.

retrieveDisplayNamesback to summary
public static String[] retrieveDisplayNames(String id, Locale locale)

Retrieve display names for a time zone ID.

retrieveDisplayNamesImplback to summary
private static String[] retrieveDisplayNamesImpl(String id, Locale locale)
retrieveGenericDisplayNameback to summary
public static String retrieveGenericDisplayName(String id, int style, Locale locale)

Retrieves a generic time zone display name for a time zone ID.

Parameters
id:String

time zone ID

style:int

TimeZone.LONG or TimeZone.SHORT

locale:Locale

desired Locale

Returns:String

the requested generic time zone display name, or null if not found.

sun.util.locale.provider back to summary

private Class TimeZoneNameUtility.TimeZoneNameGetter

extends Object
implements LocaleServiceProviderPool.LocalizedObjectGetter<TimeZoneNameProvider, String>
Class Inheritance
  • java.lang.Object
  • sun.util.locale.provider.TimeZoneNameUtility.TimeZoneNameGetter
All Implemented Interfaces
sun.util.locale.provider.LocaleServiceProviderPool.LocalizedObjectGetter

Obtains a localized time zone strings from a TimeZoneNameProvider implementation.

Field Summary

Modifier and TypeField and Description
private static final TimeZoneNameUtility.TimeZoneNameGetter

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static String
examineAliases(TimeZoneNameProvider tznp, Locale locale, String requestID, String tzid, int style, Map<String, String> aliases)

private static String
getName(TimeZoneNameProvider timeZoneNameProvider, Locale locale, String requestID, int style, String tzid)

public String
getObject(TimeZoneNameProvider timeZoneNameProvider, Locale locale, String requestID, Object... params)

Implements sun.util.locale.provider.LocaleServiceProviderPool.LocalizedObjectGetter.getObject.

Returns an object from the provider

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
private static final TimeZoneNameUtility.TimeZoneNameGetter INSTANCE

Constructor Detail

TimeZoneNameGetterback to summary
private TimeZoneNameGetter()

Method Detail

examineAliasesback to summary
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale, String requestID, String tzid, int style, Map<String, String> aliases)
getNameback to summary
private static String getName(TimeZoneNameProvider timeZoneNameProvider, Locale locale, String requestID, int style, String tzid)
getObjectback to summary
public String getObject(TimeZoneNameProvider timeZoneNameProvider, Locale locale, String requestID, Object... params)

Implements sun.util.locale.provider.LocaleServiceProviderPool.LocalizedObjectGetter.getObject.

Doc from sun.util.locale.provider.LocaleServiceProviderPool.LocalizedObjectGetter.getObject.

Returns an object from the provider

Annotations
@Override