public abstract class TimeZoneNameProvider extends LocaleServiceProvider
TimeZone类。
本类实现中可用的本地化时区名称也是DateFormatSymbols.getZoneStrings()方法的源。
| Modifier | Constructor and Description |
|---|---|
protected |
TimeZoneNameProvider()
唯一的构造函数。
|
| Modifier and Type | Method and Description |
|---|---|
abstract String |
getDisplayName(String ID, boolean daylight, int style, Locale locale)
返回适合在指定语言环境中向用户呈现的给定时区ID的名称。
|
String |
getGenericDisplayName(String ID, int style, Locale locale)
返回给定时区
ID的通用名称,适用于在指定的locale中向用户
locale 。
|
getAvailableLocales, isSupportedLocalepublic abstract String getDisplayName(String ID, boolean daylight, int style, Locale locale)
如果daylight为真,则该方法应返回适合夏令时的名称,即使指定的时区过去没有观察到夏令时。
ID - 时区ID字符串
daylight - 如果为true,则返回夏令时名称。
style -
TimeZone.LONG或
TimeZone.SHORT
locale - 所需的语言环境
IllegalArgumentException - 如果
style无效,或
locale不是从
getAvailableLocales()返回的语言环境之一。
NullPointerException - 如果
ID或
locale为空
TimeZone.getDisplayName(boolean, int, java.util.Locale)
public String getGenericDisplayName(String ID, int style, Locale locale)
ID的通用名称,适用于在指定的locale中向用户locale 。
通用时区名称在标准时间和夏令时是中性的。
例如,“PT”是时区ID America/Los_Angeles的简短通用名称,而其标准时间和夏令时间名称分别为“PST”和“PDT”。
有关有效的时区ID,请参阅getDisplayName 。
此方法的默认实现返回null 。
ID - 时区ID字符串
style -
TimeZone.LONG或
TimeZone.SHORT
locale - 所需的语言环境
null ,如果它是不可用的。
IllegalArgumentException - 如果
style无效,或
locale不是从
getAvailableLocales()返回的语言环境之一。
NullPointerException - 如果
ID或
locale是
null
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.