Package com.ibm.icu.impl
Class TimeZoneNamesImpl
- java.lang.Object
-
- com.ibm.icu.text.TimeZoneNames
-
- com.ibm.icu.impl.TimeZoneNamesImpl
-
- All Implemented Interfaces:
Serializable
public class TimeZoneNamesImpl extends TimeZoneNames
The standard ICU implementation of TimeZoneNames- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.ibm.icu.text.TimeZoneNames
TimeZoneNames.Factory, TimeZoneNames.MatchInfo, TimeZoneNames.NameType
-
-
Constructor Summary
Constructors Constructor Description TimeZoneNamesImpl(ULocale locale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<TimeZoneNames.MatchInfo>find(CharSequence text, int start, EnumSet<TimeZoneNames.NameType> nameTypes)Finds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.Set<String>getAvailableMetaZoneIDs()Returns an immutable set of all available meta zone IDs.Set<String>getAvailableMetaZoneIDs(String tzID)Returns an immutable set of all available meta zone IDs used by the given time zone.static StringgetDefaultExemplarLocationName(String tzID)Default exemplar location name based on time zone IDvoidgetDisplayNames(String tzID, TimeZoneNames.NameType[] types, long date, String[] dest, int destOffset)StringgetExemplarLocationName(String tzID)Returns the exemplar location name for the given time zone.StringgetMetaZoneDisplayName(String mzID, TimeZoneNames.NameType type)Returns the display name of the meta zone.StringgetMetaZoneID(String tzID, long date)Returns the meta zone ID for the given canonical time zone ID at the given date.StringgetReferenceZoneID(String mzID, String region)Returns the reference zone ID for the given meta zone ID for the region.StringgetTimeZoneDisplayName(String tzID, TimeZoneNames.NameType type)Returns the display name of the time zone.voidloadAllDisplayNames()-
Methods inherited from class com.ibm.icu.text.TimeZoneNames
getDisplayName, getInstance, getInstance, getTZDBInstance
-
-
-
-
Constructor Detail
-
TimeZoneNamesImpl
public TimeZoneNamesImpl(ULocale locale)
-
-
Method Detail
-
getAvailableMetaZoneIDs
public Set<String> getAvailableMetaZoneIDs()
Description copied from class:TimeZoneNamesReturns an immutable set of all available meta zone IDs.- Specified by:
getAvailableMetaZoneIDsin classTimeZoneNames- Returns:
- An immutable set of all available meta zone IDs.
-
getAvailableMetaZoneIDs
public Set<String> getAvailableMetaZoneIDs(String tzID)
Description copied from class:TimeZoneNamesReturns an immutable set of all available meta zone IDs used by the given time zone.- Specified by:
getAvailableMetaZoneIDsin classTimeZoneNames- Parameters:
tzID- The canonical time zone ID.- Returns:
- An immutable set of all available meta zone IDs used by the given time zone.
-
getMetaZoneID
public String getMetaZoneID(String tzID, long date)
Description copied from class:TimeZoneNamesReturns the meta zone ID for the given canonical time zone ID at the given date.- Specified by:
getMetaZoneIDin classTimeZoneNames- Parameters:
tzID- The canonical time zone ID.date- The date.- 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.
-
getReferenceZoneID
public String getReferenceZoneID(String mzID, String region)
Description copied from class:TimeZoneNamesReturns the reference zone ID for the given meta zone ID for the region. Note: Each meta zone must have a reference zone associated with a special region "001" (world). Some meta zones may have region specific reference zone IDs other than the special region "001". When a meta zone does not have any region specific reference zone IDs, this method return the reference zone ID for the special region "001" (world).- Specified by:
getReferenceZoneIDin classTimeZoneNames- Parameters:
mzID- The meta zone ID.region- The region.- 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.
-
getMetaZoneDisplayName
public String getMetaZoneDisplayName(String mzID, TimeZoneNames.NameType type)
Description copied from class:TimeZoneNamesReturns the display name of the meta zone.- Specified by:
getMetaZoneDisplayNamein classTimeZoneNames- Parameters:
mzID- The meta zone ID.type- The display name type. SeeTimeZoneNames.NameType.- 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.
-
getTimeZoneDisplayName
public String getTimeZoneDisplayName(String tzID, TimeZoneNames.NameType type)
Description copied from class:TimeZoneNamesReturns the display name of the time zone. UnlikeTimeZoneNames.getDisplayName(String, NameType, long), this method does not get a name from a meta zone used by the time zone.- Specified by:
getTimeZoneDisplayNamein classTimeZoneNames- Parameters:
tzID- The canonical time zone ID.type- The display name type. SeeTimeZoneNames.NameType.- 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.
-
getExemplarLocationName
public String getExemplarLocationName(String tzID)
Description copied from class:TimeZoneNamesReturns the exemplar location name for the given time zone. When this object does not have a localized location name, the default implementation may still returns a programmatically generated name with the logic described below.- Check if the ID contains "/". If not, return null.
- Check if the ID does not start with "Etc/" or "SystemV/". If it does, return null.
- Extract a substring after the last occurrence of "/".
- Replace "_" with " ".
- Overrides:
getExemplarLocationNamein classTimeZoneNames- Parameters:
tzID- The canonical time zone ID- 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.
-
find
public Collection<TimeZoneNames.MatchInfo> find(CharSequence text, int start, EnumSet<TimeZoneNames.NameType> nameTypes)
Description copied from class:TimeZoneNamesFinds time zone name prefix matches for the input text at the given offset and returns a collection of the matches.- Overrides:
findin classTimeZoneNames- Parameters:
text- the text.start- the starting offset within the text.nameTypes- the set of name types, ornullfor all name types.- Returns:
- A collection of matches.
- See Also:
TimeZoneNames.NameType,TimeZoneNames.MatchInfo
-
loadAllDisplayNames
public void loadAllDisplayNames()
- Overrides:
loadAllDisplayNamesin classTimeZoneNames
-
getDisplayNames
public void getDisplayNames(String tzID, TimeZoneNames.NameType[] types, long date, String[] dest, int destOffset)
- Overrides:
getDisplayNamesin classTimeZoneNames
-
-