static final class DateUtils.DateFormatHolder extends Object
SimpleDateFormat
s. The instances are stored in a
threadlocal way because SimpleDateFormat is not threadsafe as noted in
its javadoc
.Modifier and Type | Field and Description |
---|---|
private static ThreadLocal<SoftReference<Map<String,SimpleDateFormat>>> |
THREADLOCAL_FORMATS |
Constructor and Description |
---|
DateFormatHolder() |
Modifier and Type | Method and Description |
---|---|
static void |
clearThreadLocal() |
static SimpleDateFormat |
formatFor(String pattern)
creates a
SimpleDateFormat for the requested format string. |
private static final ThreadLocal<SoftReference<Map<String,SimpleDateFormat>>> THREADLOCAL_FORMATS
DateFormatHolder()
public static SimpleDateFormat formatFor(String pattern)
SimpleDateFormat
for the requested format string.pattern
- a non-null
format String according to
SimpleDateFormat
. The format is not checked against
null
since all paths go through
DateUtils
.apply
to a
different pattern.public static void clearThreadLocal()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses