001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    import java.text.Format;
018    
019    import java.util.Locale;
020    import java.util.TimeZone;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class FastDateFormatFactoryUtil {
026    
027            public static Format getDate(int style, Locale locale, TimeZone timeZone) {
028                    return getFastDateFormatFactory().getDate(style, locale, timeZone);
029            }
030    
031            public static Format getDate(Locale locale) {
032                    return getFastDateFormatFactory().getDate(locale);
033            }
034    
035            public static Format getDate(Locale locale, TimeZone timeZone) {
036                    return getFastDateFormatFactory().getDate(locale, timeZone);
037            }
038    
039            public static Format getDate(TimeZone timeZone) {
040                    return getFastDateFormatFactory().getDate(timeZone);
041            }
042    
043            public static Format getDateTime(
044                    int dateStyle, int timeStyle, Locale locale, TimeZone timeZone) {
045    
046                    return getFastDateFormatFactory().getDateTime(
047                            dateStyle, timeStyle, locale, timeZone);
048            }
049    
050            public static Format getDateTime(Locale locale) {
051                    return getFastDateFormatFactory().getDateTime(locale);
052            }
053    
054            public static Format getDateTime(Locale locale, TimeZone timeZone) {
055                    return getFastDateFormatFactory().getDateTime(locale, timeZone);
056            }
057    
058            public static Format getDateTime(TimeZone timeZone) {
059                    return getFastDateFormatFactory().getDateTime(timeZone);
060            }
061    
062            public static FastDateFormatFactory getFastDateFormatFactory() {
063                    return _fastDateFormatFactory;
064            }
065    
066            public static Format getSimpleDateFormat(String pattern) {
067                    return getFastDateFormatFactory().getSimpleDateFormat(pattern);
068            }
069    
070            public static Format getSimpleDateFormat(
071                    String pattern, Locale locale) {
072    
073                    return getFastDateFormatFactory().getSimpleDateFormat(pattern, locale);
074            }
075    
076            public static Format getSimpleDateFormat(
077                    String pattern, Locale locale, TimeZone timeZone) {
078    
079                    return getFastDateFormatFactory().getSimpleDateFormat(
080                            pattern, locale, timeZone);
081            }
082    
083            public static Format getSimpleDateFormat(
084                    String pattern, TimeZone timeZone) {
085    
086                    return getFastDateFormatFactory().getSimpleDateFormat(
087                            pattern, timeZone);
088            }
089    
090            public static Format getTime(int style, Locale locale, TimeZone timeZone) {
091                    return getFastDateFormatFactory().getTime(style, locale, timeZone);
092            }
093    
094            public static Format getTime(Locale locale) {
095                    return getFastDateFormatFactory().getTime(locale);
096            }
097    
098            public static Format getTime(Locale locale, TimeZone timeZone) {
099                    return getFastDateFormatFactory().getTime(locale, timeZone);
100            }
101    
102            public static Format getTime(TimeZone timeZone) {
103                    return getFastDateFormatFactory().getTime(timeZone);
104            }
105    
106            public void setFastDateFormatFactory(
107                    FastDateFormatFactory fastDateFormatFactory) {
108    
109                    _fastDateFormatFactory = fastDateFormatFactory;
110            }
111    
112            private static FastDateFormatFactory _fastDateFormatFactory;
113    
114    }