1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.util;
24  
25  import java.text.Format;
26  
27  import java.util.Locale;
28  import java.util.TimeZone;
29  
30  /**
31   * <a href="FastDateFormatFactoryUtil.java.html"><b><i>View Source</i></b></a>
32   *
33   * @author Brian Wing Shun Chan
34   */
35  public class FastDateFormatFactoryUtil {
36  
37      public static Format getDate(Locale locale) {
38          return getFastDateFormatFactory().getDate(locale);
39      }
40  
41      public static Format getDate(Locale locale, TimeZone timeZone) {
42          return getFastDateFormatFactory().getDate(locale, timeZone);
43      }
44  
45      public static Format getDate(TimeZone timeZone) {
46          return getFastDateFormatFactory().getDate(timeZone);
47      }
48  
49      public static Format getDateTime(Locale locale) {
50          return getFastDateFormatFactory().getDateTime(locale);
51      }
52  
53      public static Format getDateTime(Locale locale, TimeZone timeZone) {
54          return getFastDateFormatFactory().getDateTime(locale, timeZone);
55      }
56  
57      public static Format getDateTime(TimeZone timeZone) {
58          return getFastDateFormatFactory().getDateTime(timeZone);
59      }
60  
61      public static FastDateFormatFactory getFastDateFormatFactory() {
62          return _fastDateFormatFactory;
63      }
64  
65      public static Format getSimpleDateFormat(String pattern) {
66          return getFastDateFormatFactory().getSimpleDateFormat(pattern);
67      }
68  
69      public static Format getSimpleDateFormat(
70          String pattern, Locale locale) {
71  
72          return getFastDateFormatFactory().getSimpleDateFormat(pattern, locale);
73      }
74  
75      public static Format getSimpleDateFormat(
76          String pattern, Locale locale, TimeZone timeZone) {
77  
78          return getFastDateFormatFactory().getSimpleDateFormat(
79              pattern, locale, timeZone);
80      }
81  
82      public static Format getSimpleDateFormat(
83          String pattern, TimeZone timeZone) {
84  
85          return getFastDateFormatFactory().getSimpleDateFormat(
86              pattern, timeZone);
87      }
88  
89      public static Format getTime(Locale locale) {
90          return getFastDateFormatFactory().getTime(locale);
91      }
92  
93      public static Format getTime(Locale locale, TimeZone timeZone) {
94          return getFastDateFormatFactory().getTime(locale, timeZone);
95      }
96  
97      public static Format getTime(TimeZone timeZone) {
98          return getFastDateFormatFactory().getTime(timeZone);
99      }
100 
101     public void setFastDateFormatFactory(
102         FastDateFormatFactory fastDateFormatFactory) {
103 
104         _fastDateFormatFactory = fastDateFormatFactory;
105     }
106 
107     private static FastDateFormatFactory _fastDateFormatFactory;
108 
109 }