001    /**
002     * Copyright (c) 2000-2010 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(Locale locale) {
028                    return getFastDateFormatFactory().getDate(locale);
029            }
030    
031            public static Format getDate(Locale locale, TimeZone timeZone) {
032                    return getFastDateFormatFactory().getDate(locale, timeZone);
033            }
034    
035            public static Format getDate(TimeZone timeZone) {
036                    return getFastDateFormatFactory().getDate(timeZone);
037            }
038    
039            public static Format getDateTime(Locale locale) {
040                    return getFastDateFormatFactory().getDateTime(locale);
041            }
042    
043            public static Format getDateTime(Locale locale, TimeZone timeZone) {
044                    return getFastDateFormatFactory().getDateTime(locale, timeZone);
045            }
046    
047            public static Format getDateTime(TimeZone timeZone) {
048                    return getFastDateFormatFactory().getDateTime(timeZone);
049            }
050    
051            public static FastDateFormatFactory getFastDateFormatFactory() {
052                    return _fastDateFormatFactory;
053            }
054    
055            public static Format getSimpleDateFormat(String pattern) {
056                    return getFastDateFormatFactory().getSimpleDateFormat(pattern);
057            }
058    
059            public static Format getSimpleDateFormat(
060                    String pattern, Locale locale) {
061    
062                    return getFastDateFormatFactory().getSimpleDateFormat(pattern, locale);
063            }
064    
065            public static Format getSimpleDateFormat(
066                    String pattern, Locale locale, TimeZone timeZone) {
067    
068                    return getFastDateFormatFactory().getSimpleDateFormat(
069                            pattern, locale, timeZone);
070            }
071    
072            public static Format getSimpleDateFormat(
073                    String pattern, TimeZone timeZone) {
074    
075                    return getFastDateFormatFactory().getSimpleDateFormat(
076                            pattern, timeZone);
077            }
078    
079            public static Format getTime(Locale locale) {
080                    return getFastDateFormatFactory().getTime(locale);
081            }
082    
083            public static Format getTime(Locale locale, TimeZone timeZone) {
084                    return getFastDateFormatFactory().getTime(locale, timeZone);
085            }
086    
087            public static Format getTime(TimeZone timeZone) {
088                    return getFastDateFormatFactory().getTime(timeZone);
089            }
090    
091            public void setFastDateFormatFactory(
092                    FastDateFormatFactory fastDateFormatFactory) {
093    
094                    _fastDateFormatFactory = fastDateFormatFactory;
095            }
096    
097            private static FastDateFormatFactory _fastDateFormatFactory;
098    
099    }