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.DateFormat;
018    
019    import java.util.Locale;
020    import java.util.TimeZone;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class DateFormatFactoryUtil {
026    
027            public static DateFormat getDate(Locale locale) {
028                    return getDateFormatFactory().getDate(locale);
029            }
030    
031            public static DateFormat getDate(Locale locale, TimeZone timeZone) {
032                    return getDateFormatFactory().getDate(locale, timeZone);
033            }
034    
035            public static DateFormat getDate(TimeZone timeZone) {
036                    return getDateFormatFactory().getDate(timeZone);
037            }
038    
039            public static DateFormat getDateTime(Locale locale) {
040                    return getDateFormatFactory().getDateTime(locale);
041            }
042    
043            public static DateFormat getDateTime(Locale locale, TimeZone timeZone) {
044                    return getDateFormatFactory().getDateTime(locale, timeZone);
045            }
046    
047            public static DateFormat getDateTime(TimeZone timeZone) {
048                    return getDateFormatFactory().getDateTime(timeZone);
049            }
050    
051            public static DateFormatFactory getDateFormatFactory() {
052                    return _fastDateFormatFactory;
053            }
054    
055            public static DateFormat getSimpleDateFormat(String pattern) {
056                    return getDateFormatFactory().getSimpleDateFormat(pattern);
057            }
058    
059            public static DateFormat getSimpleDateFormat(
060                    String pattern, Locale locale) {
061    
062                    return getDateFormatFactory().getSimpleDateFormat(pattern, locale);
063            }
064    
065            public static DateFormat getSimpleDateFormat(
066                    String pattern, Locale locale, TimeZone timeZone) {
067    
068                    return getDateFormatFactory().getSimpleDateFormat(
069                            pattern, locale, timeZone);
070            }
071    
072            public static DateFormat getSimpleDateFormat(
073                    String pattern, TimeZone timeZone) {
074    
075                    return getDateFormatFactory().getSimpleDateFormat(
076                            pattern, timeZone);
077            }
078    
079            public static DateFormat getTime(Locale locale) {
080                    return getDateFormatFactory().getTime(locale);
081            }
082    
083            public static DateFormat getTime(Locale locale, TimeZone timeZone) {
084                    return getDateFormatFactory().getTime(locale, timeZone);
085            }
086    
087            public static DateFormat getTime(TimeZone timeZone) {
088                    return getDateFormatFactory().getTime(timeZone);
089            }
090    
091            public void setDateFormatFactory(
092                    DateFormatFactory fastDateFormatFactory) {
093    
094                    _fastDateFormatFactory = fastDateFormatFactory;
095            }
096    
097            private static DateFormatFactory _fastDateFormatFactory;
098    
099    }