001 /*
002 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package java.text.spi;
027
028 import java.text.DateFormat;
029 import java.util.Locale;
030 import java.util.spi.LocaleServiceProvider;
031
032 /**
033 * An abstract class for service providers that
034 * provide concrete implementations of the
035 * {@link java.text.DateFormat DateFormat} class.
036 *
037 * @since 1.6
038 * @version @(#)DateFormatProvider.java 1.8 07/05/05
039 */
040 public abstract class DateFormatProvider extends LocaleServiceProvider {
041
042 /**
043 * Sole constructor. (For invocation by subclass constructors, typically
044 * implicit.)
045 */
046 protected DateFormatProvider() {
047 }
048
049 /**
050 * Returns a new <code>DateFormat</code> instance which formats time
051 * with the given formatting style for the specified locale.
052 * @param style the given formatting style. Either one of
053 * {@link java.text.DateFormat#SHORT DateFormat.SHORT},
054 * {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},
055 * {@link java.text.DateFormat#LONG DateFormat.LONG}, or
056 * {@link java.text.DateFormat#FULL DateFormat.FULL}.
057 * @param locale the desired locale.
058 * @exception IllegalArgumentException if <code>style</code> is invalid,
059 * or if <code>locale</code> isn't
060 * one of the locales returned from
061 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
062 * getAvailableLocales()}.
063 * @exception NullPointerException if <code>locale</code> is null
064 * @return a time formatter.
065 * @see java.text.DateFormat#getTimeInstance(int, java.util.Locale)
066 */
067 public abstract DateFormat getTimeInstance(int style, Locale locale);
068
069 /**
070 * Returns a new <code>DateFormat</code> instance which formats date
071 * with the given formatting style for the specified locale.
072 * @param style the given formatting style. Either one of
073 * {@link java.text.DateFormat#SHORT DateFormat.SHORT},
074 * {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},
075 * {@link java.text.DateFormat#LONG DateFormat.LONG}, or
076 * {@link java.text.DateFormat#FULL DateFormat.FULL}.
077 * @param locale the desired locale.
078 * @exception IllegalArgumentException if <code>style</code> is invalid,
079 * or if <code>locale</code> isn't
080 * one of the locales returned from
081 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
082 * getAvailableLocales()}.
083 * @exception NullPointerException if <code>locale</code> is null
084 * @return a date formatter.
085 * @see java.text.DateFormat#getDateInstance(int, java.util.Locale)
086 */
087 public abstract DateFormat getDateInstance(int style, Locale locale);
088
089 /**
090 * Returns a new <code>DateFormat</code> instance which formats date and time
091 * with the given formatting style for the specified locale.
092 * @param dateStyle the given date formatting style. Either one of
093 * {@link java.text.DateFormat#SHORT DateFormat.SHORT},
094 * {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},
095 * {@link java.text.DateFormat#LONG DateFormat.LONG}, or
096 * {@link java.text.DateFormat#FULL DateFormat.FULL}.
097 * @param timeStyle the given time formatting style. Either one of
098 * {@link java.text.DateFormat#SHORT DateFormat.SHORT},
099 * {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},
100 * {@link java.text.DateFormat#LONG DateFormat.LONG}, or
101 * {@link java.text.DateFormat#FULL DateFormat.FULL}.
102 * @param locale the desired locale.
103 * @exception IllegalArgumentException if <code>dateStyle</code> or
104 * <code>timeStyle</code> is invalid,
105 * or if <code>locale</code> isn't
106 * one of the locales returned from
107 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
108 * getAvailableLocales()}.
109 * @exception NullPointerException if <code>locale</code> is null
110 * @return a date/time formatter.
111 * @see java.text.DateFormat#getDateTimeInstance(int, int, java.util.Locale)
112 */
113 public abstract DateFormat getDateTimeInstance(int dateStyle,
114 int timeStyle, Locale locale);
115 }
|