| 限定符和类型 | 字段和说明 |
|---|---|
private static ConcurrentMap<Tuple,String> |
cDateTimeInstanceCache |
private ConcurrentMap<Tuple,F> |
cInstanceCache |
(专用程序包) static int |
NONE
No date or no time.
|
| 构造器和说明 |
|---|
FormatCache() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract F |
createInstance(String pattern,
TimeZone timeZone,
Locale locale)
创建格式化器
|
(专用程序包) F |
getDateInstance(int dateStyle,
TimeZone timeZone,
Locale locale)
Gets a date formatter instance using the specified style, time zone and locale.
|
private F |
getDateTimeInstance(Integer dateStyle,
Integer timeStyle,
TimeZone timeZone,
Locale locale)
Gets a date/time formatter instance using the specified style, time zone and locale.
|
(专用程序包) F |
getDateTimeInstance(int dateStyle,
int timeStyle,
TimeZone timeZone,
Locale locale)
Gets a date/time formatter instance using the specified style, time zone and locale.
|
F |
getInstance()
使用默认的pattern、timezone和locale获得缓存中的实例
|
F |
getInstance(String pattern,
TimeZone timeZone,
Locale locale)
使用 pattern, time zone and locale 获得对应的 格式化器
|
(专用程序包) static String |
getPatternForStyle(Integer dateStyle,
Integer timeStyle,
Locale locale)
Gets a date/time format for the specified styles and locale.
|
(专用程序包) F |
getTimeInstance(int timeStyle,
TimeZone timeZone,
Locale locale)
Gets a time formatter instance using the specified style, time zone and locale.
|
static final int NONE
private final ConcurrentMap<Tuple,F extends Format> cInstanceCache
private static final ConcurrentMap<Tuple,String> cDateTimeInstanceCache
public F getInstance()
public F getInstance(String pattern, TimeZone timeZone, Locale locale)
pattern - 非空日期格式,使用与 SimpleDateFormat相同格式timeZone - 时区,默认当前时区locale - 地区,默认使用当前地区IllegalArgumentException - pattern 无效或nullprotected abstract F createInstance(String pattern, TimeZone timeZone, Locale locale)
pattern - 非空日期格式,使用与 SimpleDateFormat相同格式timeZone - 时区,默认当前时区locale - 地区,默认使用当前地区IllegalArgumentException - pattern 无效或nullprivate F getDateTimeInstance(Integer dateStyle, Integer timeStyle, TimeZone timeZone, Locale locale)
Gets a date/time formatter instance using the specified style, time zone and locale.
dateStyle - date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in formattimeStyle - time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in formattimeZone - optional time zone, overrides time zone of formatted date, null means use default Localelocale - optional locale, overrides system localeIllegalArgumentException - if the Locale has no date/time pattern definedF getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone, Locale locale)
Gets a date/time formatter instance using the specified style, time zone and locale.
dateStyle - date style: FULL, LONG, MEDIUM, or SHORTtimeStyle - time style: FULL, LONG, MEDIUM, or SHORTtimeZone - optional time zone, overrides time zone of formatted date, null means use default Localelocale - optional locale, overrides system localeIllegalArgumentException - if the Locale has no date/time pattern definedF getDateInstance(int dateStyle, TimeZone timeZone, Locale locale)
Gets a date formatter instance using the specified style, time zone and locale.
dateStyle - date style: FULL, LONG, MEDIUM, or SHORTtimeZone - optional time zone, overrides time zone of formatted date, null means use default Localelocale - optional locale, overrides system localeIllegalArgumentException - if the Locale has no date/time pattern definedF getTimeInstance(int timeStyle, TimeZone timeZone, Locale locale)
Gets a time formatter instance using the specified style, time zone and locale.
timeStyle - time style: FULL, LONG, MEDIUM, or SHORTtimeZone - optional time zone, overrides time zone of formatted date, null means use default Localelocale - optional locale, overrides system localeIllegalArgumentException - if the Locale has no date/time pattern definedstatic String getPatternForStyle(Integer dateStyle, Integer timeStyle, Locale locale)
Gets a date/time format for the specified styles and locale.
dateStyle - date style: FULL, LONG, MEDIUM, or SHORT, null indicates no date in formattimeStyle - time style: FULL, LONG, MEDIUM, or SHORT, null indicates no time in formatlocale - The non-null locale of the desired formatIllegalArgumentException - if the Locale has no date/time pattern definedCopyright © 2020. All rights reserved.