From f4b7d62ac57ec0c212287ed28721c8626b0f39ba Mon Sep 17 00:00:00 2001 From: Chas Honton Date: Thu, 24 Apr 2014 00:17:12 +0000 Subject: [PATCH] LANG-998 - Javadoc is not clear on preferred pattern to instantiate FastDateParser / FastDatePrinter git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1589551 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang3/time/FastDateFormat.java | 10 ++++++++++ .../org/apache/commons/lang3/time/FastDateParser.java | 8 ++++++++ .../org/apache/commons/lang3/time/FastDatePrinter.java | 8 ++++++++ 3 files changed, 26 insertions(+) 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 8efa34150..bc88b20e1 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java @@ -30,6 +30,16 @@ import java.util.TimeZone; *

FastDateFormat is a fast and thread-safe version of * {@link java.text.SimpleDateFormat}.

* + *

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)} + *

+ * + *

Since FastDateFormat is thread safe, you can use a static member instance:

+ * + * private static final FastDateFormat DATE_FORMATTER = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.SHORT); + * + * *

This class can be used as a direct replacement to * {@code SimpleDateFormat} in most formatting and parsing situations. * This class is especially useful in multi-threaded server environments. diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java index f8bb94ce8..a7d2963e5 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java @@ -41,6 +41,14 @@ import java.util.regex.Pattern; *

FastDateParser is a fast and thread-safe version of * {@link java.text.SimpleDateFormat}.

* + *

To obtain a proxy to a FastDateParser, use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} + * or another variation of the factory methods of {@link FastDateFormat}.

+ * + *

Since FastDateParser is thread safe, you can use a static member instance:

+ * + * private static final DateParser DATE_PARSER = FastDateFormat.getInstance("yyyy-MM-dd"); + * + * *

This class can be used as a direct replacement for * SimpleDateFormat in most parsing situations. * This class is especially useful in multi-threaded server environments. diff --git a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java index 44570642a..cea70c465 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java @@ -38,6 +38,14 @@ import org.apache.commons.lang3.Validate; *

FastDatePrinter is a fast and thread-safe version of * {@link java.text.SimpleDateFormat}.

* + *

To obtain a proxy to a FastDatePrinter, use {@link FastDateFormat#getInstance(String, TimeZone, Locale)} + * or another variation of the factory methods of {@link FastDateFormat}.

+ * + *

Since FastDatePrinter is thread safe, you can use a static member instance:

+ * + * private static final DatePrinter DATE_PRINTER = FastDateFormat.getInstance("yyyy-MM-dd"); + * + * *

This class can be used as a direct replacement to * {@code SimpleDateFormat} in most formatting situations. * This class is especially useful in multi-threaded server environments.