From 5f9fd135a2b5bb89ec2fe9ae16c8517bb8bb8ac9 Mon Sep 17 00:00:00 2001
From: Stephen Colebourne
This class can be used as a direct replacement to
- * SimpleDateFormat
in most formatting situations.
+ * {@code SimpleDateFormat} in most formatting situations.
* This class is especially useful in multi-threaded server environments.
- * SimpleDateFormat
is not thread-safe in any JDK version,
+ * {@code SimpleDateFormat} is not thread-safe in any JDK version,
* nor will it be as Sun have closed the bug/RFE.
*
Only formatting is supported, but all patterns are compatible with * SimpleDateFormat (except time zones - see below).
* - *Java 1.4 introduced a new pattern letter, 'Z'
, to represent
- * time zones in RFC822 format (eg. +0800
or -1100
).
+ *
Java 1.4 introduced a new pattern letter, {@code 'Z'}, to represent + * time zones in RFC822 format (eg. {@code +0800} or {@code -1100}). * This pattern letter can be used here (on all JDK versions).
* - *In addition, the pattern 'ZZ'
has been made to represent
- * ISO8601 full format time zones (eg. +08:00
or -11:00
).
+ *
In addition, the pattern {@code 'ZZ'} has been made to represent + * ISO8601 full format time zones (eg. {@code +08:00} or {@code -11:00}). * This introduces a minor incompatibility with Java 1.4, but at a gain of * useful functionality.
* @@ -192,7 +192,7 @@ public static FastDateFormat getInstance(String pattern, Locale locale) { * @param locale optional locale, overrides system locale * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid - * ornull
+ * or {@code null}
*/
public static FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) {
return cache.getInstance(pattern, timeZone, locale);
@@ -394,8 +394,7 @@ public static FastDateFormat getDateTimeInstance(
*
* @param tz the zone to query
* @param daylight true if daylight savings
- * @param style the style to use TimeZone.LONG
- * or TimeZone.SHORT
+ * @param style the style to use {@code TimeZone.LONG} or {@ TimeZone.SHORT}
* @param locale the locale to use
* @return the textual name of the time zone
*/
@@ -451,7 +450,7 @@ private void init() {
/**
* Returns a list of Rules given a pattern.
* - * @return aList
of Rule objects
+ * @return a {@code List} of Rule objects
* @throws IllegalArgumentException if pattern is invalid
*/
protected ListFormats a Date
, Calendar
or
- * Long
(milliseconds) object.
Formats a {@code Date}, {@code Calendar} or + * {@code Long} (milliseconds) object.
* * @param obj the object to format * @param toAppendTo the buffer to append to @@ -680,7 +679,7 @@ public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition po } /** - *Formats a millisecond long
value.
Formats a millisecond {@code long} value.
* * @param millis the millisecond value to format * @return the formatted string @@ -691,7 +690,7 @@ public String format(long millis) { } /** - *Formats a Date
object.
Formats a {@code Date} object.
* * @param date the date to format * @return the formatted string @@ -703,7 +702,7 @@ public String format(Date date) { } /** - *Formats a Calendar
object.
Formats a {@code Calendar} object.
* * @param calendar the calendar to format * @return the formatted string @@ -713,8 +712,8 @@ public String format(Calendar calendar) { } /** - *Formats a milliseond long
value into the
- * supplied StringBuffer
.
Formats a milliseond {@code long} value into the + * supplied {@code StringBuffer}.
* * @param millis the millisecond value to format * @param buf the buffer to format into @@ -726,8 +725,8 @@ public StringBuffer format(long millis, StringBuffer buf) { } /** - *Formats a Date
object into the
- * supplied StringBuffer
.
Formats a {@code Date} object into the + * supplied {@code StringBuffer}.
* * @param date the date to format * @param buf the buffer to format into @@ -740,8 +739,8 @@ public StringBuffer format(Date date, StringBuffer buf) { } /** - *Formats a Calendar
object into the
- * supplied StringBuffer
.
Formats a {@code Calendar} object into the + * supplied {@code StringBuffer}.
* * @param calendar the calendar to format * @param buf the buffer to format into @@ -773,7 +772,7 @@ protected StringBuffer applyRules(Calendar calendar, StringBuffer buf) { * * @param source the string to parse * @param pos the parsing position - * @returnnull
as not supported
+ * @return {@code null} as not supported
*/
@Override
public Object parseObject(String source, ParsePosition pos) {
@@ -796,7 +795,7 @@ public String getPattern() {
/**
* Gets the time zone used by this formatter.
* - *This zone is always used for Date
formatting.
This zone is always used for {@code Date} formatting.
* * @return the time zone */ @@ -832,7 +831,7 @@ public int getMaxLengthEstimate() { *Compares two objects for equality.
* * @param obj the object to compare to - * @returntrue
if equal
+ * @return {@code true} if equal
*/
@Override
public boolean equals(Object obj) {
@@ -922,7 +921,7 @@ private static class CharacterLiteral implements Rule {
private final char mValue;
/**
- * Constructs a new instance of CharacterLiteral
+ * Constructs a new instance of {@code CharacterLiteral}
* to hold the specified value.
*
* @param value the character literal
@@ -953,7 +952,7 @@ private static class StringLiteral implements Rule {
private final String mValue;
/**
- * Constructs a new instance of StringLiteral
+ * Constructs a new instance of {@code StringLiteral}
* to hold the specified value.
*
* @param value the string literal
@@ -985,7 +984,7 @@ private static class TextField implements Rule {
private final String[] mValues;
/**
- * Constructs an instance of TextField
+ * Constructs an instance of {@code TextField}
* with the specified field and values.
*
* @param field the field
@@ -1025,7 +1024,7 @@ private static class UnpaddedNumberField implements NumberRule {
private final int mField;
/**
- * Constructs an instance of UnpadedNumberField
with the specified field.
+ * Constructs an instance of {@code UnpadedNumberField} with the specified field.
*
* @param field the field
*/
@@ -1069,7 +1068,7 @@ private static class UnpaddedMonthField implements NumberRule {
static final UnpaddedMonthField INSTANCE = new UnpaddedMonthField();
/**
- * Constructs an instance of UnpaddedMonthField
.
+ * Constructs an instance of {@code UnpaddedMonthField}.
*
*/
UnpaddedMonthField() {
@@ -1111,7 +1110,7 @@ private static class PaddedNumberField implements NumberRule {
private final int mSize;
/**
- * Constructs an instance of PaddedNumberField
.
+ * Constructs an instance of {@code PaddedNumberField}.
*
* @param field the field
* @param size size of the output field
@@ -1172,7 +1171,7 @@ private static class TwoDigitNumberField implements NumberRule {
private final int mField;
/**
- * Constructs an instance of TwoDigitNumberField
with the specified field.
+ * Constructs an instance of {@code TwoDigitNumberField} with the specified field.
*
* @param field the field
*/
@@ -1214,7 +1213,7 @@ private static class TwoDigitYearField implements NumberRule {
static final TwoDigitYearField INSTANCE = new TwoDigitYearField();
/**
- * Constructs an instance of TwoDigitYearField
.
+ * Constructs an instance of {@code TwoDigitYearField}.
*/
TwoDigitYearField() {
super();
@@ -1250,7 +1249,7 @@ private static class TwoDigitMonthField implements NumberRule {
static final TwoDigitMonthField INSTANCE = new TwoDigitMonthField();
/**
- * Constructs an instance of TwoDigitMonthField
.
+ * Constructs an instance of {@code TwoDigitMonthField}.
*/
TwoDigitMonthField() {
super();
@@ -1286,8 +1285,8 @@ private static class TwelveHourField implements NumberRule {
private final NumberRule mRule;
/**
- * Constructs an instance of TwelveHourField
with the specified
- * NumberRule
.
+ * Constructs an instance of {@code TwelveHourField} with the specified
+ * {@code NumberRule}.
*
* @param rule the rule
*/
@@ -1328,8 +1327,8 @@ private static class TwentyFourHourField implements NumberRule {
private final NumberRule mRule;
/**
- * Constructs an instance of TwentyFourHourField
with the specified
- * NumberRule
.
+ * Constructs an instance of {@code TwentyFourHourField} with the specified
+ * {@code NumberRule}.
*
* @param rule the rule
*/
@@ -1372,7 +1371,7 @@ private static class TimeZoneNameRule implements Rule {
private final String mDaylight;
/**
- * Constructs an instance of TimeZoneNameRule
with the specified properties.
+ * Constructs an instance of {@code TimeZoneNameRule} with the specified properties.
*
* @param timeZone the time zone
* @param locale the locale
@@ -1405,8 +1404,8 @@ public void appendTo(StringBuffer buffer, Calendar calendar) {
}
/**
- * Inner class to output a time zone as a number +/-HHMM
- * or +/-HH:MM
.
Inner class to output a time zone as a number {@code +/-HHMM} + * or {@code +/-HH:MM}.
*/ private static class TimeZoneNumberRule implements Rule { static final TimeZoneNumberRule INSTANCE_COLON = new TimeZoneNumberRule(true); @@ -1415,9 +1414,9 @@ private static class TimeZoneNumberRule implements Rule { final boolean mColon; /** - * Constructs an instance ofTimeZoneNumberRule
with the specified properties.
+ * Constructs an instance of {@code TimeZoneNumberRule} with the specified properties.
*
- * @param colon add colon between HH and MM in the output if true
+ * @param colon add colon between HH and MM in the output if {@code true}
*/
TimeZoneNumberRule(boolean colon) {
mColon = colon;
@@ -1467,10 +1466,10 @@ private static class TimeZoneDisplayKey {
private final Locale mLocale;
/**
- * Constructs an instance of TimeZoneDisplayKey
with the specified properties.
+ * Constructs an instance of {@code TimeZoneDisplayKey} with the specified properties.
*
* @param timeZone the time zone
- * @param daylight adjust the style for daylight saving time if true
+ * @param daylight adjust the style for daylight saving time if {@code true}
* @param style the timezone style
* @param locale the timezone locale
*/