Top Description Inners Fields Constructors Methods
com.ibm.icu.text

public abstract Class TimeZoneNames

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
com.ibm.icu.text.TimeZoneNames.DefaultTimeZoneNames, com.ibm.icu.impl.TimeZoneNamesImpl, com.ibm.icu.impl.TZDBTimeZoneNames
Imports
java.io.Serializable, java.util.Collection, .Collections, .EnumSet, .Locale, .Set, com.ibm.icu.impl.ICUConfig, .SoftCache, .TZDBTimeZoneNames, .TimeZoneNamesImpl, com.ibm.icu.util.TimeZone, .ULocale

TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#35 Unicode Locale Data Markup Language (LDML). The model defines meta zone, which is used for storing a set of display names. A meta zone can be shared by multiple time zones. Also a time zone may have multiple meta zone historic mappings.

For example, people in the United States refer the zone used by the east part of North America as "Eastern Time". The tz database contains multiple time zones "America/New_York", "America/Detroit", "America/Montreal" and some others that belong to "Eastern Time". However, assigning different display names to these time zones does not make much sense for most of people.

In CLDR (which uses LDML for representing locale data), the display name "Eastern Time" is stored as long generic display name of a meta zone identified by the ID "America_Eastern". Then, there is another table maintaining the historic mapping to meta zones for each time zone. The time zones in the above example ("America/New_York", "America/Detroit"...) are mapped to the meta zone "America_Eastern".

Sometimes, a time zone is mapped to a different time zone in the past. For example, "America/Indiana/Knox" had been moving "Eastern Time" and "Central Time" back and forth. Therefore, it is necessary that time zone to meta zones mapping data are stored by date range.

Note:

TimeZoneFormat assumes an instance of TimeZoneNames is immutable. If you want to provide your own TimeZoneNames implementation and use it with TimeZoneFormat, you must follow the contract.

The methods in this class assume that time zone IDs are already canonicalized. For example, you may not get proper result returned by a method with time zone ID "America/Indiana/Indianapolis", because it's not a canonical time zone ID (the canonical time zone ID for the time zone is "America/Indianapolis". See TimeZone#getCanonicalID(String) about ICU canonical time zone IDs.

In CLDR, most of time zone display names except location names are provided through meta zones. But a time zone may have a specific name that is not shared with other time zones. For example, time zone "Europe/London" has English long name for standard time "Greenwich Mean Time", which is also shared with other time zones. However, the long name for daylight saving time is "British Summer Time", which is only used for "Europe/London".

getTimeZoneDisplayName(String, NameType) is designed for accessing a name only used by a single time zone. But is not necessarily mean that a subclass implementation use the same model with CLDR. A subclass implementation may provide time zone names only through getTimeZoneDisplayName(String, NameType), or only through getMetaZoneDisplayName(String, NameType), or both.

The default TimeZoneNames implementation returned by getInstance(ULocale) uses the locale data imported from CLDR. In CLDR, set of meta zone IDs and mappings between zone IDs and meta zone IDs are shared by all locales. Therefore, the behavior of getAvailableMetaZoneIDs(), getAvailableMetaZoneIDs(String), getMetaZoneID(String, long), and getReferenceZoneID(String, String) won't be changed no matter what locale is used for getting an instance of TimeZoneNames.

ICU Status
Stable since ICU 49.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
TimeZoneNames.DefaultTimeZoneNames

The default implementation of TimeZoneNames used by TimeZoneNames#getInstance(ULocale) when the ICU4J tznamedata component is not available.

public abstract static class
TimeZoneNames.Factory

Deprecated This API is ICU internal only.
The super class of TimeZoneNames service factory classes.
public static class
TimeZoneNames.MatchInfo

A MatchInfo represents a time zone name match used by TimeZoneNames#find(CharSequence, int, EnumSet).

public static enum
TimeZoneNames.NameType

Time zone display name types

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final long
private static TimeZoneNames.Cache
private static final TimeZoneNames.Factory
TZNAMES_FACTORY

Deprecated as a consequence of TimeZoneNames.Factory being deprecated.

Constructor Summary

AccessConstructor and Description
protected
TimeZoneNames()

Sole constructor for invocation by subclass constructors.

Method Summary

Modifier and TypeMethod and Description
public Collection<TimeZoneNames.MatchInfo>

Returns:

A collection of matches.
find
(CharSequence
the text.
text
,
int
the starting offset within the text.
start
,
EnumSet<TimeZoneNames.NameType>
the set of name types, or null for all name types.
types
)

Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.

public abstract Set<String>

Returns:

An immutable set of all available meta zone IDs.
getAvailableMetaZoneIDs
()

Returns an immutable set of all available meta zone IDs.

public abstract Set<String>

Returns:

An immutable set of all available meta zone IDs used by the given time zone.
getAvailableMetaZoneIDs
(String
The canonical time zone ID.
tzID
)

Returns an immutable set of all available meta zone IDs used by the given time zone.

public final String

Returns:

The display name for the time zone at the given date. When this object does not have a localized display name for the time zone with the specified type and date, null is returned.
getDisplayName
(String
The canonical time zone ID.
tzID
,
TimeZoneNames.NameType
The display name type. See TimeZoneNames.NameType.
type
,
long
The date
date
)

Returns the display name of the time zone at the given date.

public void
getDisplayNames(String tzID, TimeZoneNames.NameType[] types, long date, String[] dest, int destOffset)

Deprecated This API is ICU internal only.
public String

Returns:

The exemplar location name for the given time zone, or null when a localized location name is not available and the fallback logic described above cannot extract location from the ID.
getExemplarLocationName
(String
The canonical time zone ID
tzID
)

Returns the exemplar location name for the given time zone.

public static TimeZoneNames

Returns:

An instance of TimeZoneNames
getInstance
(ULocale
The locale.
locale
)

Returns an instance of TimeZoneNames for the specified locale.

public static TimeZoneNames

Returns:

An instance of TimeZoneDisplayNames
getInstance
(Locale locale)

Returns an instance of TimeZoneNames for the specified java.util.Locale.

public abstract String

Returns:

The display name of the meta zone. When this object does not have a localized display name for the given meta zone with the specified type or the implementation does not provide any display names associated with meta zones, null is returned.
getMetaZoneDisplayName
(String
The meta zone ID.
mzID
,
TimeZoneNames.NameType
The display name type. See TimeZoneNames.NameType.
type
)

Returns the display name of the meta zone.

public abstract String

Returns:

The meta zone ID for the given time zone ID at the given date. If the time zone does not have a corresponding meta zone at the given date or the implementation does not support meta zones, null is returned.
getMetaZoneID
(String
The canonical time zone ID.
tzID
,
long
The date.
date
)

Returns the meta zone ID for the given canonical time zone ID at the given date.

public abstract String

Returns:

The reference zone ID ("golden zone" in the LDML specification) for the given time zone ID for the region. If the meta zone is unknown or the implementation does not support meta zones, null is returned.
getReferenceZoneID
(String
The meta zone ID.
mzID
,
String
The region.
region
)

Returns the reference zone ID for the given meta zone ID for the region.

public abstract String

Returns:

The display name for the time zone. When this object does not have a localized display name for the given time zone with the specified type, null is returned.
getTimeZoneDisplayName
(String
The canonical time zone ID.
tzID
,
TimeZoneNames.NameType
The display name type. See TimeZoneNames.NameType.
type
)

Returns the display name of the time zone.

public static TimeZoneNames
getTZDBInstance(ULocale locale)

Returns an instance of TimeZoneNames containing only short specific zone names (NameType#SHORT_STANDARD and NameType#SHORT_DAYLIGHT), compatible with the IANA tz database's zone abbreviations (not localized).

public void
loadAllDisplayNames()

Deprecated This API is ICU internal only.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait