|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.icu.text.TimeZoneNames
public abstract class TimeZoneNames
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.
Nested Class Summary | |
---|---|
static class |
TimeZoneNames.Factory
Deprecated. The super class of TimeZoneNames service factory classes. |
static class |
TimeZoneNames.MatchInfo
Deprecated. This API might change or be removed in a future release. |
static class |
TimeZoneNames.NameType
Deprecated. This API might change or be removed in a future release. |
Constructor Summary | |
---|---|
protected |
TimeZoneNames()
Deprecated. This API might change or be removed in a future release. |
Method Summary | |
---|---|
Collection<TimeZoneNames.MatchInfo> |
find(String text,
int start,
EnumSet<TimeZoneNames.NameType> types)
Deprecated. This API might change or be removed in a future release. |
abstract Set<String> |
getAvailableMetaZoneIDs()
Deprecated. This API might change or be removed in a future release. |
abstract Set<String> |
getAvailableMetaZoneIDs(String tzID)
Deprecated. This API might change or be removed in a future release. |
String |
getDisplayName(String tzID,
TimeZoneNames.NameType type,
long date)
Deprecated. This API might change or be removed in a future release. |
String |
getExemplarLocationName(String tzID)
Deprecated. This API might change or be removed in a future release. |
static TimeZoneNames |
getInstance(ULocale locale)
Deprecated. This API might change or be removed in a future release. |
abstract String |
getMetaZoneDisplayName(String mzID,
TimeZoneNames.NameType type)
Deprecated. This API might change or be removed in a future release. |
abstract String |
getMetaZoneID(String tzID,
long date)
Deprecated. This API might change or be removed in a future release. |
abstract String |
getReferenceZoneID(String mzID,
String region)
Deprecated. This API might change or be removed in a future release. |
abstract String |
getTimeZoneDisplayName(String tzID,
TimeZoneNames.NameType type)
Deprecated. This API might change or be removed in a future release. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected TimeZoneNames()
Method Detail |
---|
public static TimeZoneNames getInstance(ULocale locale)
TimeZoneDisplayNames
for the specified locale.
locale
- The locale.
TimeZoneDisplayNames
public abstract Set<String> getAvailableMetaZoneIDs()
public abstract Set<String> getAvailableMetaZoneIDs(String tzID)
tzID
- The canonical time zone ID.
public abstract String getMetaZoneID(String tzID, long date)
tzID
- The canonical time zone ID.date
- The date.
public abstract String getReferenceZoneID(String mzID, String region)
mzID
- The meta zone ID.region
- The region.
public abstract String getMetaZoneDisplayName(String mzID, TimeZoneNames.NameType type)
mzID
- The meta zone ID.type
- The display name type. See TimeZoneNames.NameType
.
public final String getDisplayName(String tzID, TimeZoneNames.NameType type, long date)
Note: This method calls the subclass's getTimeZoneDisplayName(String, NameType)
first. When the
result is null, this method calls getMetaZoneID(String, long)
to get the meta zone ID mapped from the
time zone, then calls getMetaZoneDisplayName(String, NameType)
.
tzID
- The canonical time zone ID.type
- The display name type. See TimeZoneNames.NameType
.date
- The date
public abstract String getTimeZoneDisplayName(String tzID, TimeZoneNames.NameType type)
getDisplayName(String, NameType, long)
,
this method does not get a name from a meta zone used by the time zone.
tzID
- The canonical time zone ID.type
- The display name type. See TimeZoneNames.NameType
.
public String getExemplarLocationName(String tzID)
tzID
- The canonical time zone ID
public Collection<TimeZoneNames.MatchInfo> find(String text, int start, EnumSet<TimeZoneNames.NameType> types)
text
- the text.start
- the starting offset within the text.types
- the set of name types, or null
for all name types.
TimeZoneNames.NameType
,
TimeZoneNames.MatchInfo
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |