public class ConcurrentDateFormat extends SimpleDateFormat
ConcurrentDateFormat can be casted to
SimpleDateFormat with additional thread safety which
SimpleDateFormat cannot provide.DateFormat.FieldAM_PM_FIELD, calendar, DATE_FIELD, DAY_OF_WEEK_FIELD, DAY_OF_WEEK_IN_MONTH_FIELD, DAY_OF_YEAR_FIELD, DEFAULT, ERA_FIELD, FULL, HOUR_OF_DAY0_FIELD, HOUR_OF_DAY1_FIELD, HOUR0_FIELD, HOUR1_FIELD, LONG, MEDIUM, MILLISECOND_FIELD, MINUTE_FIELD, MONTH_FIELD, numberFormat, SECOND_FIELD, SHORT, TIMEZONE_FIELD, WEEK_OF_MONTH_FIELD, WEEK_OF_YEAR_FIELD, YEAR_FIELD| Constructor and Description |
|---|
ConcurrentDateFormat() |
ConcurrentDateFormat(String pattern) |
ConcurrentDateFormat(String pattern,
Locale locale) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyLocalizedPattern(String pattern)
Deprecated.
as it is not considered to be thread safe.
|
void |
applyPattern(String pattern)
Deprecated.
as it is not considered to be thread safe.
|
StringBuffer |
format(Date date,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
This method is overridden as the
DateFormat.format(Date) method is final
and calls this method. |
AttributedCharacterIterator |
formatToCharacterIterator(Object obj)
Deprecated.
as it is not considered to be thread safe.
|
Date |
get2DigitYearStart()
Deprecated.
as it is not considered to be thread safe.
|
Calendar |
getCalendar()
Deprecated.
as it is not considered to be thread safe.
|
DateFormatSymbols |
getDateFormatSymbols()
Deprecated.
as it is not considered to be thread safe.
|
NumberFormat |
getNumberFormat()
Deprecated.
as it is not considered to be thread safe.
|
TimeZone |
getTimeZone()
Deprecated.
as it is not considered to be thread safe.
|
boolean |
isLenient()
Deprecated.
as it is not considered to be thread safe.
|
Date |
parse(String source)
Delegate the parse method to the thread safe
FastDateFormat
class. |
Date |
parse(String text,
ParsePosition pos)
Deprecated.
as it is only thread safe due to synchronization.
|
Object |
parseObject(String source)
Deprecated.
as it is not considered to be thread safe.
|
Object |
parseObject(String source,
ParsePosition pos)
Deprecated.
as it is not considered to be thread safe.
|
void |
set2DigitYearStart(Date startDate)
Deprecated.
as it is not considered to be thread safe.
|
void |
setCalendar(Calendar newCalendar)
Deprecated.
as it is not considered to be thread safe.
|
void |
setDateFormatSymbols(DateFormatSymbols newFormatSymbols)
Deprecated.
as it is not considered to be thread safe.
|
void |
setLenient(boolean lenient)
Deprecated.
as it is not considered to be thread safe.
|
void |
setNumberFormat(NumberFormat newNumberFormat)
Deprecated.
as it is not considered to be thread safe.
|
void |
setTimeZone(TimeZone zone)
Deprecated.
as it is not considered to be thread safe.
|
String |
toString(Date aDate)
This methods is a substitute for the
DateFormat.format(Date) method which
(in this case) unnecessarily calls the
format(Date, StringBuffer, FieldPosition) method with the result
of creating unnecessary StringBuffer instances; please use this
substitute of DateFormat.format(Date). |
clone, equals, hashCode, toLocalizedPattern, toPatternformat, format, getAvailableLocales, getDateInstance, getDateInstance, getDateInstance, getDateTimeInstance, getDateTimeInstance, getDateTimeInstance, getInstance, getTimeInstance, getTimeInstance, getTimeInstancepublic ConcurrentDateFormat()
public ConcurrentDateFormat(String pattern)
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition)
DateFormat.format(Date) method is final
and calls this method.format in class SimpleDateFormatpublic String toString(Date aDate)
DateFormat.format(Date) method which
(in this case) unnecessarily calls the
format(Date, StringBuffer, FieldPosition) method with the result
of creating unnecessary StringBuffer instances; please use this
substitute of DateFormat.format(Date).aDate - The date to be formatted according to the given date.public Date parse(String source) throws ParseException
FastDateFormat
class.parse in class DateFormatParseException@Deprecated public Date parse(String text, ParsePosition pos)
FastDateFormat does not implement its
Format.parseObject(String) nor the
FastDateFormat.parseObject(String, ParsePosition) methods :-(
Therefore we only can make this method thread safe by synchronizing.parse in class SimpleDateFormat@Deprecated public void set2DigitYearStart(Date startDate)
set2DigitYearStart in class SimpleDateFormat@Deprecated public Date get2DigitYearStart()
get2DigitYearStart in class SimpleDateFormat@Deprecated public AttributedCharacterIterator formatToCharacterIterator(Object obj)
formatToCharacterIterator in class SimpleDateFormat@Deprecated public void applyPattern(String pattern)
applyPattern in class SimpleDateFormat@Deprecated public void applyLocalizedPattern(String pattern)
applyLocalizedPattern in class SimpleDateFormat@Deprecated public DateFormatSymbols getDateFormatSymbols()
getDateFormatSymbols in class SimpleDateFormat@Deprecated public void setDateFormatSymbols(DateFormatSymbols newFormatSymbols)
setDateFormatSymbols in class SimpleDateFormat@Deprecated public Object parseObject(String source, ParsePosition pos)
parseObject in class DateFormat@Deprecated public void setCalendar(Calendar newCalendar)
setCalendar in class DateFormat@Deprecated public Calendar getCalendar()
getCalendar in class DateFormat@Deprecated public void setNumberFormat(NumberFormat newNumberFormat)
setNumberFormat in class DateFormat@Deprecated public NumberFormat getNumberFormat()
getNumberFormat in class DateFormat@Deprecated public void setTimeZone(TimeZone zone)
setTimeZone in class DateFormat@Deprecated public TimeZone getTimeZone()
getTimeZone in class DateFormat@Deprecated public void setLenient(boolean lenient)
setLenient in class DateFormat@Deprecated public boolean isLenient()
isLenient in class DateFormat@Deprecated public Object parseObject(String source) throws ParseException
parseObject in class FormatParseExceptionCopyright © 2016. All rights reserved.