Package com.ibm.icu.impl
Class TimeZoneGenericNames
- java.lang.Object
-
- com.ibm.icu.impl.TimeZoneGenericNames
-
- All Implemented Interfaces:
Freezable<TimeZoneGenericNames>,Serializable,Cloneable
public class TimeZoneGenericNames extends Object implements Serializable, Freezable<TimeZoneGenericNames>
This class interact with TimeZoneNames and LocaleDisplayNames to format and parse time zone's generic display names. It is not recommended to use this class directly, instead use com.ibm.icu.text.TimeZoneFormat.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTimeZoneGenericNames.GenericMatchInfoA class used for returning the name search result used byfind(String, int, EnumSet).static classTimeZoneGenericNames.GenericNameTypeGeneric name type enumstatic classTimeZoneGenericNames.PatternFormat pattern enum used for composing location and partial location names
-
Constructor Summary
Constructors Constructor Description TimeZoneGenericNames(ULocale locale, TimeZoneNames tznames)Constructs aTimeZoneGenericNameswith the given locale and theTimeZoneNames.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeZoneGenericNamescloneAsThawed()Provides for the clone operation.Collection<TimeZoneGenericNames.GenericMatchInfo>find(String text, int start, EnumSet<TimeZoneGenericNames.GenericNameType> genericTypes)Returns a collection of time zone display name matches for the specified types in the given text at the given offset.TimeZoneGenericNames.GenericMatchInfofindBestMatch(String text, int start, EnumSet<TimeZoneGenericNames.GenericNameType> genericTypes)Returns the best match of time zone display name for the specified types in the given text at the given offset.TimeZoneGenericNamesfreeze()Freezes the object.StringgetDisplayName(TimeZone tz, TimeZoneGenericNames.GenericNameType type, long date)Returns the display name of the time zone for the given name type at the given date, or null if the display name is not available.StringgetGenericLocationName(String canonicalTzID)Returns the generic location name for the given canonical time zone ID.static TimeZoneGenericNamesgetInstance(ULocale locale)The factory method ofTimeZoneGenericNames.booleanisFrozen()Determines whether the object has been frozen or not.TimeZoneGenericNamessetFormatPattern(TimeZoneGenericNames.Pattern patType, String patStr)Sets the pattern string for the pattern type.
-
-
-
Constructor Detail
-
TimeZoneGenericNames
public TimeZoneGenericNames(ULocale locale, TimeZoneNames tznames)
Constructs aTimeZoneGenericNameswith the given locale and theTimeZoneNames.- Parameters:
locale- the localetznames- the TimeZoneNames
-
-
Method Detail
-
getInstance
public static TimeZoneGenericNames getInstance(ULocale locale)
The factory method ofTimeZoneGenericNames. This static method returns a frozen instance of cachedTimeZoneGenericNames.- Parameters:
locale- the locale- Returns:
- A frozen
TimeZoneGenericNames.
-
getDisplayName
public String getDisplayName(TimeZone tz, TimeZoneGenericNames.GenericNameType type, long date)
Returns the display name of the time zone for the given name type at the given date, or null if the display name is not available.- Parameters:
tz- the time zonetype- the generic name type - seeTimeZoneGenericNames.GenericNameTypedate- the date- Returns:
- the display name of the time zone for the given name type at the given date, or null.
-
getGenericLocationName
public String getGenericLocationName(String canonicalTzID)
Returns the generic location name for the given canonical time zone ID.- Parameters:
canonicalTzID- the canonical time zone ID- Returns:
- the generic location name for the given canonical time zone ID.
-
setFormatPattern
public TimeZoneGenericNames setFormatPattern(TimeZoneGenericNames.Pattern patType, String patStr)
Sets the pattern string for the pattern type. Note: This method is designed for CLDR ST - not for common use.- Parameters:
patType- the pattern typepatStr- the pattern string- Returns:
- this object.
-
findBestMatch
public TimeZoneGenericNames.GenericMatchInfo findBestMatch(String text, int start, EnumSet<TimeZoneGenericNames.GenericNameType> genericTypes)
Returns the best match of time zone display name for the specified types in the given text at the given offset.- Parameters:
text- the textstart- the start offset in the textgenericTypes- the set of name types.- Returns:
- the best matching name info.
-
find
public Collection<TimeZoneGenericNames.GenericMatchInfo> find(String text, int start, EnumSet<TimeZoneGenericNames.GenericNameType> genericTypes)
Returns a collection of time zone display name matches for the specified types in the given text at the given offset.- Parameters:
text- the textstart- the start offset in the textgenericTypes- the set of name types.- Returns:
- A collection of match info.
-
isFrozen
public boolean isFrozen()
Determines whether the object has been frozen or not.- Specified by:
isFrozenin interfaceFreezable<TimeZoneGenericNames>
-
freeze
public TimeZoneGenericNames freeze()
Freezes the object.- Specified by:
freezein interfaceFreezable<TimeZoneGenericNames>- Returns:
- the object itself.
-
cloneAsThawed
public TimeZoneGenericNames cloneAsThawed()
Provides for the clone operation. Any clone is initially unfrozen.- Specified by:
cloneAsThawedin interfaceFreezable<TimeZoneGenericNames>
-
-