001    /**
002     * Copyright (c) 2000-2012 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(String pattern, Locale locale) {
071                    return getFastDateFormatFactory().getSimpleDateFormat(pattern, locale);
072            }
073    
074            public static Format getSimpleDateFormat(
075                    String pattern, Locale locale, TimeZone timeZone) {
076    
077                    return getFastDateFormatFactory().getSimpleDateFormat(
078                            pattern, locale, timeZone);
079            }
080    
081            public static Format getSimpleDateFormat(
082                    String pattern, TimeZone timeZone) {
083    
084                    return getFastDateFormatFactory().getSimpleDateFormat(
085                            pattern, timeZone);
086            }
087    
088            public static Format getTime(int style, Locale locale, TimeZone timeZone) {
089                    return getFastDateFormatFactory().getTime(style, locale, timeZone);
090            }
091    
092            public static Format getTime(Locale locale) {
093                    return getFastDateFormatFactory().getTime(locale);
094            }
095    
096            public static Format getTime(Locale locale, TimeZone timeZone) {
097                    return getFastDateFormatFactory().getTime(locale, timeZone);
098            }
099    
100            public static Format getTime(TimeZone timeZone) {
101                    return getFastDateFormatFactory().getTime(timeZone);
102            }
103    
104            public void setFastDateFormatFactory(
105                    FastDateFormatFactory fastDateFormatFactory) {
106    
107                    _fastDateFormatFactory = fastDateFormatFactory;
108            }
109    
110            private static FastDateFormatFactory _fastDateFormatFactory;
111    
112    }