@@ -101,13 +101,21 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
101101 */
102102 public static final int SHORT = DateFormat .SHORT ;
103103
104- private static final AbstractFormatCache <FastDateFormat > cache = new AbstractFormatCache <FastDateFormat >() {
104+ private static final AbstractFormatCache <FastDateFormat > CACHE = new AbstractFormatCache <FastDateFormat >() {
105105 @ Override
106106 protected FastDateFormat createInstance (final String pattern , final TimeZone timeZone , final Locale locale ) {
107107 return new FastDateFormat (pattern , timeZone , locale );
108108 }
109109 };
110110
111+ /**
112+ * Clears the cache.
113+ */
114+ static void clear () {
115+ AbstractFormatCache .clear ();
116+ CACHE .clearInstance ();
117+ }
118+
111119 /**
112120 * Gets a date formatter instance using the specified style in the
113121 * default time zone and locale.
@@ -119,7 +127,7 @@ protected FastDateFormat createInstance(final String pattern, final TimeZone tim
119127 * @since 2.1
120128 */
121129 public static FastDateFormat getDateInstance (final int style ) {
122- return cache .getDateInstance (style , null , null );
130+ return CACHE .getDateInstance (style , null , null );
123131 }
124132
125133 /**
@@ -134,7 +142,7 @@ public static FastDateFormat getDateInstance(final int style) {
134142 * @since 2.1
135143 */
136144 public static FastDateFormat getDateInstance (final int style , final Locale locale ) {
137- return cache .getDateInstance (style , null , locale );
145+ return CACHE .getDateInstance (style , null , locale );
138146 }
139147
140148 /**
@@ -150,7 +158,7 @@ public static FastDateFormat getDateInstance(final int style, final Locale local
150158 * @since 2.1
151159 */
152160 public static FastDateFormat getDateInstance (final int style , final TimeZone timeZone ) {
153- return cache .getDateInstance (style , timeZone , null );
161+ return CACHE .getDateInstance (style , timeZone , null );
154162 }
155163
156164 /**
@@ -166,7 +174,7 @@ public static FastDateFormat getDateInstance(final int style, final TimeZone tim
166174 * pattern defined
167175 */
168176 public static FastDateFormat getDateInstance (final int style , final TimeZone timeZone , final Locale locale ) {
169- return cache .getDateInstance (style , timeZone , locale );
177+ return CACHE .getDateInstance (style , timeZone , locale );
170178 }
171179
172180 /**
@@ -181,7 +189,7 @@ public static FastDateFormat getDateInstance(final int style, final TimeZone tim
181189 * @since 2.1
182190 */
183191 public static FastDateFormat getDateTimeInstance (final int dateStyle , final int timeStyle ) {
184- return cache .getDateTimeInstance (dateStyle , timeStyle , null , null );
192+ return CACHE .getDateTimeInstance (dateStyle , timeStyle , null , null );
185193 }
186194
187195 /**
@@ -197,7 +205,7 @@ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int
197205 * @since 2.1
198206 */
199207 public static FastDateFormat getDateTimeInstance (final int dateStyle , final int timeStyle , final Locale locale ) {
200- return cache .getDateTimeInstance (dateStyle , timeStyle , null , locale );
208+ return CACHE .getDateTimeInstance (dateStyle , timeStyle , null , locale );
201209 }
202210
203211 /**
@@ -232,7 +240,7 @@ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int
232240 */
233241 public static FastDateFormat getDateTimeInstance (
234242 final int dateStyle , final int timeStyle , final TimeZone timeZone , final Locale locale ) {
235- return cache .getDateTimeInstance (dateStyle , timeStyle , timeZone , locale );
243+ return CACHE .getDateTimeInstance (dateStyle , timeStyle , timeZone , locale );
236244 }
237245
238246 /**
@@ -242,7 +250,7 @@ public static FastDateFormat getDateTimeInstance(
242250 * @return a date/time formatter
243251 */
244252 public static FastDateFormat getInstance () {
245- return cache .getInstance ();
253+ return CACHE .getInstance ();
246254 }
247255
248256 /**
@@ -255,7 +263,7 @@ public static FastDateFormat getInstance() {
255263 * @throws IllegalArgumentException if pattern is invalid
256264 */
257265 public static FastDateFormat getInstance (final String pattern ) {
258- return cache .getInstance (pattern , null , null );
266+ return CACHE .getInstance (pattern , null , null );
259267 }
260268
261269 /**
@@ -269,7 +277,7 @@ public static FastDateFormat getInstance(final String pattern) {
269277 * @throws IllegalArgumentException if pattern is invalid
270278 */
271279 public static FastDateFormat getInstance (final String pattern , final Locale locale ) {
272- return cache .getInstance (pattern , null , locale );
280+ return CACHE .getInstance (pattern , null , locale );
273281 }
274282
275283 /**
@@ -284,7 +292,7 @@ public static FastDateFormat getInstance(final String pattern, final Locale loca
284292 * @throws IllegalArgumentException if pattern is invalid
285293 */
286294 public static FastDateFormat getInstance (final String pattern , final TimeZone timeZone ) {
287- return cache .getInstance (pattern , timeZone , null );
295+ return CACHE .getInstance (pattern , timeZone , null );
288296 }
289297
290298 /**
@@ -301,7 +309,7 @@ public static FastDateFormat getInstance(final String pattern, final TimeZone ti
301309 * or {@code null}
302310 */
303311 public static FastDateFormat getInstance (final String pattern , final TimeZone timeZone , final Locale locale ) {
304- return cache .getInstance (pattern , timeZone , locale );
312+ return CACHE .getInstance (pattern , timeZone , locale );
305313 }
306314
307315 /**
@@ -315,7 +323,7 @@ public static FastDateFormat getInstance(final String pattern, final TimeZone ti
315323 * @since 2.1
316324 */
317325 public static FastDateFormat getTimeInstance (final int style ) {
318- return cache .getTimeInstance (style , null , null );
326+ return CACHE .getTimeInstance (style , null , null );
319327 }
320328
321329 /**
@@ -330,7 +338,7 @@ public static FastDateFormat getTimeInstance(final int style) {
330338 * @since 2.1
331339 */
332340 public static FastDateFormat getTimeInstance (final int style , final Locale locale ) {
333- return cache .getTimeInstance (style , null , locale );
341+ return CACHE .getTimeInstance (style , null , locale );
334342 }
335343
336344 /**
@@ -346,7 +354,7 @@ public static FastDateFormat getTimeInstance(final int style, final Locale local
346354 * @since 2.1
347355 */
348356 public static FastDateFormat getTimeInstance (final int style , final TimeZone timeZone ) {
349- return cache .getTimeInstance (style , timeZone , null );
357+ return CACHE .getTimeInstance (style , timeZone , null );
350358 }
351359
352360 /**
@@ -362,7 +370,7 @@ public static FastDateFormat getTimeInstance(final int style, final TimeZone tim
362370 * pattern defined
363371 */
364372 public static FastDateFormat getTimeInstance (final int style , final TimeZone timeZone , final Locale locale ) {
365- return cache .getTimeInstance (style , timeZone , locale );
373+ return CACHE .getTimeInstance (style , timeZone , locale );
366374 }
367375
368376 /** Our fast printer. */
0 commit comments