You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/10/25 21:35:28 UTC
(commons-lang) 03/04: Javadoc
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
commit 21e65f8b312c6608b554e4f551315fb0651c3277
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Oct 25 17:30:36 2025 -0400
Javadoc
---
.../apache/commons/lang3/time/FastDateFormat.java | 424 ++++++++++-----------
1 file changed, 192 insertions(+), 232 deletions(-)
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
index 9b3df28b3..811e3c76e 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.lang3.time;
import java.text.DateFormat;
@@ -29,45 +30,48 @@
import java.util.TimeZone;
/**
- * FastDateFormat is a fast and thread-safe version of
- * {@link java.text.SimpleDateFormat}.
+ * FastDateFormat is a fast and thread-safe version of {@link java.text.SimpleDateFormat}.
*
- * <p>To obtain an instance of FastDateFormat, use one of the static factory methods:
- * {@link #getInstance(String, TimeZone, Locale)}, {@link #getDateInstance(int, TimeZone, Locale)},
- * {@link #getTimeInstance(int, TimeZone, Locale)}, or {@link #getDateTimeInstance(int, int, TimeZone, Locale)}
+ * <p>
+ * To obtain an instance of FastDateFormat, use one of the static factory methods: {@link #getInstance(String, TimeZone, Locale)},
+ * {@link #getDateInstance(int, TimeZone, Locale)}, {@link #getTimeInstance(int, TimeZone, Locale)}, or {@link #getDateTimeInstance(int, int, TimeZone, Locale)}
* </p>
*
- * <p>Since FastDateFormat is thread safe, you can use a static member instance:</p>
+ * <p>
+ * Since FastDateFormat is thread safe, you can use a static member instance:
+ * </p>
* {@code
* private static final FastDateFormat DATE_FORMATTER = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.SHORT);
* }
*
- * <p>This class can be used as a direct replacement to
- * {@link SimpleDateFormat} in most formatting and parsing situations.
- * This class is especially useful in multi-threaded server environments.
- * {@link SimpleDateFormat} is not thread-safe in any JDK version,
- * nor will it be as Sun have closed the bug/RFE.
+ * <p>
+ * This class can be used as a direct replacement to {@link SimpleDateFormat} in most formatting and parsing situations. This class is especially useful in
+ * multi-threaded server environments. {@link SimpleDateFormat} is not thread-safe in any JDK version, nor will it be as Sun have closed the bug/RFE.
* </p>
*
- * <p>All patterns are compatible with
- * SimpleDateFormat (except time zones and some year patterns - see below).</p>
+ * <p>
+ * All patterns are compatible with SimpleDateFormat (except time zones and some year patterns - see below).
+ * </p>
*
- * <p>Since 3.2, FastDateFormat supports parsing as well as printing.</p>
+ * <p>
+ * Since 3.2, FastDateFormat supports parsing as well as printing.
+ * </p>
*
- * <p>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).</p>
+ * <p>
+ * 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).
+ * </p>
*
- * <p>In addition, the pattern {@code 'ZZ'} has been made to represent
- * ISO 8601 extended 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.</p>
+ * <p>
+ * In addition, the pattern {@code 'ZZ'} has been made to represent ISO 8601 extended 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.
+ * </p>
*
- * <p>Javadoc cites for the year pattern: <i>For formatting, if the number of
- * pattern letters is 2, the year is truncated to 2 digits; otherwise it is
- * interpreted as a number.</i> Starting with Java 1.7 a pattern of 'Y' or
- * 'YYY' will be formatted as '2003', while it was '03' in former Java
- * versions. FastDateFormat implements the behavior of Java 7.</p>
+ * <p>
+ * Javadoc cites for the year pattern: <i>For formatting, if the number of pattern letters is 2, the year is truncated to 2 digits; otherwise it is interpreted
+ * as a number.</i> Starting with Java 1.7 a pattern of 'Y' or 'YYY' will be formatted as '2003', while it was '03' in former Java versions. FastDateFormat
+ * implements the behavior of Java 7.
+ * </p>
*
* @since 2.0
*/
@@ -83,7 +87,6 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
/**
* FULL locale dependent date or time style.
*/
-
public static final int FULL = DateFormat.FULL;
/**
@@ -102,6 +105,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
public static final int SHORT = DateFormat.SHORT;
private static final AbstractFormatCache<FastDateFormat> CACHE = new AbstractFormatCache<FastDateFormat>() {
+
@Override
protected FastDateFormat createInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return new FastDateFormat(pattern, timeZone, locale);
@@ -117,13 +121,11 @@ static void clear() {
}
/**
- * Gets a date formatter instance using the specified style in the
- * default time zone and locale.
+ * Gets a date formatter instance using the specified style in the default time zone and locale.
*
- * @param style date style: FULL, LONG, MEDIUM, or SHORT
- * @return a localized standard date formatter
- * @throws IllegalArgumentException if the Locale has no date
- * pattern defined
+ * @param style date style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @return a localized standard date formatter.
+ * @throws IllegalArgumentException if the Locale has no date pattern defined.
* @since 2.1
*/
public static FastDateFormat getDateInstance(final int style) {
@@ -131,14 +133,12 @@ public static FastDateFormat getDateInstance(final int style) {
}
/**
- * Gets a date formatter instance using the specified style and
- * locale in the default time zone.
+ * Gets a date formatter instance using the specified style and locale in the default time zone.
*
- * @param style date style: FULL, LONG, MEDIUM, or SHORT
- * @param locale optional locale, overrides system locale
- * @return a localized standard date formatter
- * @throws IllegalArgumentException if the Locale has no date
- * pattern defined
+ * @param style date style: {@link #FULL}, LO{@link #FULL},{@link #MEDIUM}, or {@link #SHORT}.
+ * @param locale optional locale, overrides system locale.
+ * @return a localized standard date formatter.
+ * @throws IllegalArgumentException if the Locale has no date pattern defined.
* @since 2.1
*/
public static FastDateFormat getDateInstance(final int style, final Locale locale) {
@@ -146,15 +146,12 @@ public static FastDateFormat getDateInstance(final int style, final Locale local
}
/**
- * Gets a date formatter instance using the specified style and
- * time zone in the default locale.
+ * Gets a date formatter instance using the specified style and time zone in the default locale.
*
- * @param style date style: FULL, LONG, MEDIUM, or SHORT
- * @param timeZone optional time zone, overrides time zone of
- * formatted date
- * @return a localized standard date formatter
- * @throws IllegalArgumentException if the Locale has no date
- * pattern defined
+ * @param style date style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeZone optional time zone, overrides time zone of formatted date.
+ * @return a localized standard date formatter.
+ * @throws IllegalArgumentException if the Locale has no date pattern defined.
* @since 2.1
*/
public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone) {
@@ -162,30 +159,25 @@ public static FastDateFormat getDateInstance(final int style, final TimeZone tim
}
/**
- * Gets a date formatter instance using the specified style, time
- * zone and locale.
+ * Gets a date formatter instance using the specified style, time zone and locale.
*
- * @param style date style: FULL, LONG, MEDIUM, or SHORT
- * @param timeZone optional time zone, overrides time zone of
- * formatted date
- * @param locale optional locale, overrides system locale
- * @return a localized standard date formatter
- * @throws IllegalArgumentException if the Locale has no date
- * pattern defined
+ * @param style date style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeZone optional time zone, overrides time zone of formatted date.
+ * @param locale optional locale, overrides system locale.
+ * @return a localized standard date formatter.
+ * @throws IllegalArgumentException if the Locale has no date pattern defined.
*/
public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) {
return CACHE.getDateInstance(style, timeZone, locale);
}
/**
- * Gets a date/time formatter instance using the specified style
- * in the default time zone and locale.
+ * Gets a date/time formatter instance using the specified style in the default time zone and locale.
*
- * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
- * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
- * @return a localized standard date/time formatter
- * @throws IllegalArgumentException if the Locale has no date/time
- * pattern defined
+ * @param dateStyle date style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeStyle time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @return a localized standard date/time formatter.
+ * @throws IllegalArgumentException if the Locale has no date/time pattern defined.
* @since 2.1
*/
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) {
@@ -193,15 +185,13 @@ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int
}
/**
- * Gets a date/time formatter instance using the specified style and
- * locale in the default time zone.
+ * Gets a date/time formatter instance using the specified style and locale in the default time zone.
*
- * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
- * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
- * @param locale optional locale, overrides system locale
- * @return a localized standard date/time formatter
- * @throws IllegalArgumentException if the Locale has no date/time
- * pattern defined
+ * @param dateStyle date style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeStyle time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param locale optional locale, overrides system locale.
+ * @return a localized standard date/time formatter.
+ * @throws IllegalArgumentException if the Locale has no date/time pattern defined.
* @since 2.1
*/
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final Locale locale) {
@@ -209,16 +199,13 @@ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int
}
/**
- * Gets a date/time formatter instance using the specified style and
- * time zone in the default locale.
+ * Gets a date/time formatter instance using the specified style and time zone in the default locale.
*
- * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
- * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
- * @param timeZone optional time zone, overrides time zone of
- * formatted date
- * @return a localized standard date/time formatter
- * @throws IllegalArgumentException if the Locale has no date/time
- * pattern defined
+ * @param dateStyle date style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeStyle time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeZone optional time zone, overrides time zone of formatted date.
+ * @return a localized standard date/time formatter.
+ * @throws IllegalArgumentException if the Locale has no date/time pattern defined.
* @since 2.1
*/
public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone) {
@@ -226,100 +213,82 @@ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int
}
/**
- * Gets a date/time formatter instance using the specified style,
- * time zone and locale.
+ * Gets a date/time formatter instance using the specified style, time zone and locale.
*
- * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT
- * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT
- * @param timeZone optional time zone, overrides time zone of
- * formatted date
- * @param locale optional locale, overrides system locale
- * @return a localized standard date/time formatter
- * @throws IllegalArgumentException if the Locale has no date/time
- * pattern defined
+ * @param dateStyle date style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeStyle time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeZone optional time zone, overrides time zone of formatted date.
+ * @param locale optional locale, overrides system locale.
+ * @return a localized standard date/time formatter.
+ * @throws IllegalArgumentException if the Locale has no date/time pattern defined.
*/
- public static FastDateFormat getDateTimeInstance(
- final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
+ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) {
return CACHE.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale);
}
/**
- * Gets a formatter instance using the default pattern in the
- * default locale.
+ * Gets a formatter instance using the default pattern in the default locale.
*
- * @return a date/time formatter
+ * @return a date/time formatter.
*/
public static FastDateFormat getInstance() {
return CACHE.getInstance();
}
/**
- * Gets a formatter instance using the specified pattern in the
- * default locale.
+ * Gets a formatter instance using the specified pattern in the default locale and time zone.
*
- * @param pattern {@link java.text.SimpleDateFormat} compatible
- * pattern
- * @return a pattern based date/time formatter
- * @throws IllegalArgumentException if pattern is invalid
+ * @param pattern {@link java.text.SimpleDateFormat} compatible pattern.
+ * @return a pattern based date/time formatter.
+ * @throws IllegalArgumentException if pattern is invalid.
*/
public static FastDateFormat getInstance(final String pattern) {
return CACHE.getInstance(pattern, null, null);
}
/**
- * Gets a formatter instance using the specified pattern and
- * locale.
+ * Gets a formatter instance using the specified pattern and locale.
*
- * @param pattern {@link java.text.SimpleDateFormat} compatible
- * pattern
- * @param locale optional locale, overrides system locale
- * @return a pattern based date/time formatter
- * @throws IllegalArgumentException if pattern is invalid
+ * @param pattern {@link java.text.SimpleDateFormat} compatible pattern.
+ * @param locale optional locale, overrides system locale.
+ * @return a pattern based date/time formatter.
+ * @throws IllegalArgumentException if pattern is invalid.
*/
public static FastDateFormat getInstance(final String pattern, final Locale locale) {
return CACHE.getInstance(pattern, null, locale);
}
/**
- * Gets a formatter instance using the specified pattern and
- * time zone.
+ * Gets a formatter instance using the specified pattern and time zone.
*
- * @param pattern {@link java.text.SimpleDateFormat} compatible
- * pattern
- * @param timeZone optional time zone, overrides time zone of
- * formatted date
- * @return a pattern based date/time formatter
- * @throws IllegalArgumentException if pattern is invalid
+ * @param pattern {@link java.text.SimpleDateFormat} compatible pattern.
+ * @param timeZone optional time zone, overrides time zone of formatted date.
+ * @return a pattern based date/time formatter.
+ * @throws IllegalArgumentException if pattern is invalid.
*/
public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone) {
return CACHE.getInstance(pattern, timeZone, null);
}
/**
- * Gets a formatter instance using the specified pattern, time zone
- * and locale.
+ * Gets a formatter instance using the specified pattern, time zone and locale.
*
- * @param pattern {@link java.text.SimpleDateFormat} compatible
- * pattern
- * @param timeZone optional time zone, overrides time zone of
- * formatted date
- * @param locale optional locale, overrides system locale
- * @return a pattern based date/time formatter
- * @throws IllegalArgumentException if pattern is invalid
- * or {@code null}
+ * @param pattern {@link java.text.SimpleDateFormat} compatible pattern.
+ * @param timeZone optional time zone, overrides time zone of formatted date.
+ * @param locale optional locale, overrides system locale.
+ * @return a pattern based date/time formatter.
+ * @throws IllegalArgumentException if pattern is invalid or {@code null}.
*/
public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
return CACHE.getInstance(pattern, timeZone, locale);
}
/**
- * Gets a time formatter instance using the specified style in the
- * default time zone and locale.
+ * Gets a time formatter instance using the specified style in the default time zone and locale.
*
- * @param style time style: FULL, LONG, MEDIUM, or SHORT
- * @return a localized standard time formatter
- * @throws IllegalArgumentException if the Locale has no time
- * pattern defined
+ * @param style time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @return a localized standard time formatter.
+ * @throws IllegalArgumentException if the Locale has no time pattern defined.
* @since 2.1
*/
public static FastDateFormat getTimeInstance(final int style) {
@@ -327,14 +296,12 @@ public static FastDateFormat getTimeInstance(final int style) {
}
/**
- * Gets a time formatter instance using the specified style and
- * locale in the default time zone.
+ * Gets a time formatter instance using the specified style and locale in the default time zone.
*
- * @param style time style: FULL, LONG, MEDIUM, or SHORT
- * @param locale optional locale, overrides system locale
- * @return a localized standard time formatter
- * @throws IllegalArgumentException if the Locale has no time
- * pattern defined
+ * @param style time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param locale optional locale, overrides system locale.
+ * @return a localized standard time formatter.
+ * @throws IllegalArgumentException if the Locale has no time pattern defined.
* @since 2.1
*/
public static FastDateFormat getTimeInstance(final int style, final Locale locale) {
@@ -342,15 +309,12 @@ public static FastDateFormat getTimeInstance(final int style, final Locale local
}
/**
- * Gets a time formatter instance using the specified style and
- * time zone in the default locale.
+ * Gets a time formatter instance using the specified style and time zone in the default locale.
*
- * @param style time style: FULL, LONG, MEDIUM, or SHORT
- * @param timeZone optional time zone, overrides time zone of
- * formatted time
- * @return a localized standard time formatter
- * @throws IllegalArgumentException if the Locale has no time
- * pattern defined
+ * @param style time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeZone optional time zone, overrides time zone of formatted time.
+ * @return a localized standard time formatter.
+ * @throws IllegalArgumentException if the Locale has no time pattern defined.
* @since 2.1
*/
public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone) {
@@ -358,16 +322,13 @@ public static FastDateFormat getTimeInstance(final int style, final TimeZone tim
}
/**
- * Gets a time formatter instance using the specified style, time
- * zone and locale.
+ * Gets a time formatter instance using the specified style, time zone and locale.
*
- * @param style time style: FULL, LONG, MEDIUM, or SHORT
- * @param timeZone optional time zone, overrides time zone of
- * formatted time
- * @param locale optional locale, overrides system locale
- * @return a localized standard time formatter
- * @throws IllegalArgumentException if the Locale has no time
- * pattern defined
+ * @param style time style: {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, or {@link #SHORT}.
+ * @param timeZone optional time zone, overrides time zone of formatted time.
+ * @param locale optional locale, overrides system locale.
+ * @return a localized standard time formatter.
+ * @throws IllegalArgumentException if the Locale has no time pattern defined.
*/
public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
return CACHE.getTimeInstance(style, timeZone, locale);
@@ -382,9 +343,9 @@ public static FastDateFormat getTimeInstance(final int style, final TimeZone tim
/**
* Constructs a new FastDateFormat.
*
- * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
- * @param timeZone non-null time zone to use
- * @param locale non-null locale to use
+ * @param pattern {@link java.text.SimpleDateFormat} compatible pattern.
+ * @param timeZone non-null time zone to use.
+ * @param locale non-null locale to use.
* @throws NullPointerException if pattern, timeZone, or locale is null.
*/
protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale) {
@@ -395,10 +356,11 @@ protected FastDateFormat(final String pattern, final TimeZone timeZone, final Lo
/**
* Constructs a new FastDateFormat.
*
- * @param pattern {@link java.text.SimpleDateFormat} compatible pattern
- * @param timeZone non-null time zone to use
- * @param locale non-null locale to use
- * @param centuryStart The start of the 100-year period to use as the "default century" for 2 digit year parsing. If centuryStart is null, defaults to now - 80 years
+ * @param pattern {@link java.text.SimpleDateFormat} compatible pattern.
+ * @param timeZone non-null time zone to use.
+ * @param locale non-null locale to use.
+ * @param centuryStart The start of the 100-year period to useas the "default century" for 2 digit year parsing. If centuryStart is null, defaults to now -
+ * 80 years.
* @throws NullPointerException if pattern, timeZone, or locale is null.
*/
protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale, final Date centuryStart) {
@@ -407,12 +369,11 @@ protected FastDateFormat(final String pattern, final TimeZone timeZone, final Lo
}
/**
- * Performs the formatting by applying the rules to the
- * specified calendar.
+ * Performs the formatting by applying the rules to the specified calendar.
*
- * @param calendar the calendar to format
- * @param buf the buffer to format into
- * @return the specified string buffer
+ * @param calendar the calendar to format.
+ * @param buf the buffer to format into.
+ * @return the specified string buffer.
* @deprecated Use {@link #format(Calendar, Appendable)}
*/
@Deprecated
@@ -424,8 +385,8 @@ protected StringBuffer applyRules(final Calendar calendar, final StringBuffer bu
/**
* Compares two objects for equality.
*
- * @param obj the object to compare to
- * @return {@code true} if equal
+ * @param obj the object to compare to.
+ * @return {@code true} if equal.
*/
@Override
public boolean equals(final Object obj) {
@@ -440,8 +401,8 @@ public boolean equals(final Object obj) {
/**
* Formats a {@link Calendar} object.
*
- * @param calendar the calendar to format
- * @return the formatted string
+ * @param calendar the calendar to format.
+ * @return the formatted string.
*/
@Override
public String format(final Calendar calendar) {
@@ -449,26 +410,24 @@ public String format(final Calendar calendar) {
}
/**
- * Formats a {@link Calendar} object into the
- * supplied {@link StringBuffer}.
+ * Formats a {@link Calendar} object into the supplied {@link StringBuffer}.
*
- * @param calendar the calendar to format
- * @param buf the buffer to format into
- * @return the specified string buffer
+ * @param calendar the calendar to format.
+ * @param buf the buffer to format into.
+ * @return the specified string buffer.
* @since 3.5
- */
+ */
@Override
public <B extends Appendable> B format(final Calendar calendar, final B buf) {
return printer.format(calendar, buf);
}
/**
- * Formats a {@link Calendar} object into the
- * supplied {@link StringBuffer}.
+ * Formats a {@link Calendar} object into the supplied {@link StringBuffer}.
*
- * @param calendar the calendar to format
- * @param buf the buffer to format into
- * @return the specified string buffer
+ * @param calendar the calendar to format.
+ * @param buf the buffer to format into.
+ * @return the specified string buffer.
* @deprecated Use {{@link #format(Calendar, Appendable)}.
*/
@Deprecated
@@ -480,8 +439,8 @@ public StringBuffer format(final Calendar calendar, final StringBuffer buf) {
/**
* Formats a {@link Date} object using a {@link GregorianCalendar}.
*
- * @param date the date to format
- * @return the formatted string
+ * @param date the date to format.
+ * @return the formatted string.
*/
@Override
public String format(final Date date) {
@@ -489,12 +448,11 @@ public String format(final Date date) {
}
/**
- * Formats a {@link Date} object into the
- * supplied {@link StringBuffer} using a {@link GregorianCalendar}.
+ * Formats a {@link Date} object into the supplied {@link StringBuffer} using a {@link GregorianCalendar}.
*
- * @param date the date to format
- * @param buf the buffer to format into
- * @return the specified string buffer
+ * @param date the date to format.
+ * @param buf the buffer to format into.
+ * @return the specified string buffer.
* @since 3.5
*/
@Override
@@ -503,12 +461,11 @@ public <B extends Appendable> B format(final Date date, final B buf) {
}
/**
- * Formats a {@link Date} object into the
- * supplied {@link StringBuffer} using a {@link GregorianCalendar}.
+ * Formats a {@link Date} object into the supplied {@link StringBuffer} using a {@link GregorianCalendar}.
*
- * @param date the date to format
- * @param buf the buffer to format into
- * @return the specified string buffer
+ * @param date the date to format.
+ * @param buf the buffer to format into.
+ * @return the specified string buffer.
* @deprecated Use {{@link #format(Date, Appendable)}.
*/
@Deprecated
@@ -520,8 +477,8 @@ public StringBuffer format(final Date date, final StringBuffer buf) {
/**
* Formats a millisecond {@code long} value.
*
- * @param millis the millisecond value to format
- * @return the formatted string
+ * @param millis the millisecond value to format.
+ * @return the formatted string.
* @since 2.1
*/
@Override
@@ -530,12 +487,11 @@ public String format(final long millis) {
}
/**
- * Formats a millisecond {@code long} value into the
- * supplied {@link StringBuffer}.
+ * Formats a millisecond {@code long} value into the supplied {@link StringBuffer}.
*
- * @param millis the millisecond value to format
- * @param buf the buffer to format into
- * @return the specified string buffer
+ * @param millis the millisecond value to format.
+ * @param buf the buffer to format into.
+ * @return the specified string buffer.
* @since 3.5
*/
@Override
@@ -543,15 +499,12 @@ public <B extends Appendable> B format(final long millis, final B buf) {
return printer.format(millis, buf);
}
- // Parsing
-
/**
- * Formats a millisecond {@code long} value into the
- * supplied {@link StringBuffer}.
+ * Formats a millisecond {@code long} value into the supplied {@link StringBuffer}.
*
- * @param millis the millisecond value to format
- * @param buf the buffer to format into
- * @return the specified string buffer
+ * @param millis the millisecond value to format.
+ * @param buf the buffer to format into.
+ * @return the specified string buffer.
* @since 2.1
* @deprecated Use {{@link #format(long, Appendable)}.
*/
@@ -561,16 +514,14 @@ public StringBuffer format(final long millis, final StringBuffer buf) {
return printer.format(millis, buf);
}
- // Format methods
/**
- * Formats a {@link Date}, {@link Calendar} or
- * {@link Long} (milliseconds) object.
- * This method is an implementation of {@link Format#format(Object, StringBuffer, FieldPosition)}
+ * Formats a {@link Date}, {@link Calendar} or {@link Long} (milliseconds) object. This method is an implementation of
+ * {@link Format#format(Object, StringBuffer, FieldPosition)}
*
- * @param obj the object to format
- * @param toAppendTo the buffer to append to
- * @param pos the position - ignored
- * @return the buffer passed in
+ * @param obj the object to format.
+ * @param toAppendTo the buffer to append to.
+ * @param pos the position, ignored.
+ * @return the given buffer.
*/
@Override
public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) {
@@ -580,7 +531,7 @@ public StringBuffer format(final Object obj, final StringBuffer toAppendTo, fina
/**
* Gets the locale used by this formatter.
*
- * @return the locale
+ * @return the locale.
*/
@Override
public Locale getLocale() {
@@ -588,13 +539,13 @@ public Locale getLocale() {
}
/**
- * Gets an estimate for the maximum string length that the
- * formatter will produce.
+ * Gets an estimate for the maximum string length that the formatter will produce.
*
- * <p>The actual formatted length will almost always be less than or
- * equal to this amount.</p>
+ * <p>
+ * The actual formatted length will almost always be less than or equal to this amount.
+ * </p>
*
- * @return the maximum formatted length
+ * @return the maximum formatted length.
*/
public int getMaxLengthEstimate() {
return printer.getMaxLengthEstimate();
@@ -604,7 +555,7 @@ public int getMaxLengthEstimate() {
/**
* Gets the pattern used by this formatter.
*
- * @return the pattern, {@link java.text.SimpleDateFormat} compatible
+ * @return the pattern, {@link java.text.SimpleDateFormat} compatible.
*/
@Override
public String getPattern() {
@@ -614,9 +565,11 @@ public String getPattern() {
/**
* Gets the time zone used by this formatter.
*
- * <p>This zone is always used for {@link Date} formatting.</p>
+ * <p>
+ * This zone is always used for {@link Date} formatting.
+ * </p>
*
- * @return the time zone
+ * @return the time zone.
*/
@Override
public TimeZone getTimeZone() {
@@ -626,14 +579,16 @@ public TimeZone getTimeZone() {
/**
* Returns a hash code compatible with equals.
*
- * @return a hash code compatible with equals
+ * @return a hash code compatible with equals.
*/
@Override
public int hashCode() {
return printer.hashCode();
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see DateParser#parse(String)
*/
@Override
@@ -641,7 +596,9 @@ public Date parse(final String source) throws ParseException {
return parser.parse(source);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see DateParser#parse(String, java.text.ParsePosition)
*/
@Override
@@ -651,6 +608,7 @@ public Date parse(final String source, final ParsePosition pos) {
/*
* (non-Javadoc)
+ *
* @see org.apache.commons.lang3.time.DateParser#parse(String, java.text.ParsePosition, java.util.Calendar)
*/
@Override
@@ -658,7 +616,9 @@ public boolean parse(final String source, final ParsePosition pos, final Calenda
return parser.parse(source, pos, calendar);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see java.text.Format#parseObject(String, java.text.ParsePosition)
*/
@Override
@@ -669,7 +629,7 @@ public Object parseObject(final String source, final ParsePosition pos) {
/**
* Gets a debugging string version of this formatter.
*
- * @return a debugging string
+ * @return a debug string.
*/
@Override
public String toString() {