01 /*
02 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
03 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04 *
05 * This code is free software; you can redistribute it and/or modify it
06 * under the terms of the GNU General Public License version 2 only, as
07 * published by the Free Software Foundation. Sun designates this
08 * particular file as subject to the "Classpath" exception as provided
09 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26 package java.util.spi;
27
28 import java.util.Locale;
29
30 /**
31 * An abstract class for service providers that
32 * provide localized time zone names for the
33 * {@link java.util.TimeZone TimeZone} class.
34 * The localized time zone names available from the implementations of
35 * this class are also the source for the
36 * {@link java.text.DateFormatSymbols#getZoneStrings()
37 * DateFormatSymbols.getZoneStrings()} method.
38 *
39 * @since 1.6
40 * @version @(#)TimeZoneNameProvider.java 1.8 07/05/05
41 */
42 public abstract class TimeZoneNameProvider extends
43 LocaleServiceProvider {
44
45 /**
46 * Sole constructor. (For invocation by subclass constructors, typically
47 * implicit.)
48 */
49 protected TimeZoneNameProvider() {
50 }
51
52 /**
53 * Returns a name for the given time zone ID that's suitable for
54 * presentation to the user in the specified locale. The given time
55 * zone ID is "GMT" or one of the names defined using "Zone" entries
56 * in the "tz database", a public domain time zone database at
57 * <a href="ftp://elsie.nci.nih.gov/pub/">ftp://elsie.nci.nih.gov/pub/</a>.
58 * The data of this database is contained in a file whose name starts with
59 * "tzdata", and the specification of the data format is part of the zic.8
60 * man page, which is contained in a file whose name starts with "tzcode".
61 * <p>
62 * If <code>daylight</code> is true, the method should return a name
63 * appropriate for daylight saving time even if the specified time zone
64 * has not observed daylight saving time in the past.
65 *
66 * @param ID a time zone ID string
67 * @param daylight if true, return the daylight saving name.
68 * @param style either {@link java.util.TimeZone#LONG TimeZone.LONG} or
69 * {@link java.util.TimeZone#SHORT TimeZone.SHORT}
70 * @param locale the desired locale
71 * @return the human-readable name of the given time zone in the
72 * given locale, or null if it's not available.
73 * @exception IllegalArgumentException if <code>style</code> is invalid,
74 * or <code>locale</code> isn't one of the locales returned from
75 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
76 * getAvailableLocales()}.
77 * @exception NullPointerException if <code>ID</code> or <code>locale</code>
78 * is null
79 * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
80 */
81 public abstract String getDisplayName(String ID, boolean daylight,
82 int style, Locale locale);
83 }
|