Source for java.util.spi.TimeZoneNameProvider

   1: /* TimeZoneNameProvider.java -- Providers of localized currency symbols
   2:    Copyright (C) 2007 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: package java.util.spi;
  39: 
  40: import java.util.Locale;
  41: 
  42: /**
  43:  * A {@link TimeZoneNameProvider} provides localized
  44:  * versions of the names that represent a particular
  45:  * timezone.  A <code>null</code> value may
  46:  * be returned, which should be treated as a lack of
  47:  * support for the specified {@link Locale}.  The names
  48:  * from this class are also used by
  49:  * {@link DateFormatSymbols#getZoneStrings()}.
  50:  *
  51:  * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  52:  * @since 1.6
  53:  */
  54: public abstract class TimeZoneNameProvider
  55:   extends LocaleServiceProvider
  56: {
  57: 
  58:   /**
  59:    * Constructs a new {@link TimeZoneNameProvider}.
  60:    * Provided for implicit invocation by subclasses.
  61:    */
  62:   protected TimeZoneNameProvider()
  63:   {
  64:   }
  65: 
  66:   /**
  67:    * Returns a name for the specified time zone identifier
  68:    * localized to the supplied {@link java.util.Locale}.
  69:    * The time zone identifier is either <code>"GMT"</code>
  70:    * or one of the identifiers from the public domain "tz
  71:    * database" found at <a href="ftp://elsie.nci.nih.gov/pub/">
  72:    * ftp://elsie.nci.nih.gov/pub</a>.  Note that a translated
  73:    * name for the daylight savings time variant should be returned,
  74:    * even if the timezone has not observed daylight savings
  75:    * time in the past.  If the name of the timezone
  76:    * in the given locale is not supported, <code>null</code>
  77:    * is returned.
  78:    *
  79:    * @param id a time zone identifier.
  80:    * @param daylight true if the daylight savings time variant
  81:    *                 should be returned.
  82:    * @param style either {@link java.util.TimeZone.LONG} or
  83:    *              {@link java.util.TimeZone.SHORT}
  84:    * @param locale the locale to express the timezone in.
  85:    * @return the localized time zone name, or <code>null</code>
  86:    *         if one is not available.
  87:    * @throws NullPointerException if the identifer or locale is null.
  88:    * @throws IllegalArgumentException if the style is invalid
  89:    *                                  or the locale is not one
  90:    *                                  returned by
  91:    *                                  {@link getAvailableLocales()}
  92:    * @see java.util.TimeZone#getDisplayName(boolean,int,java.util.Locale)
  93:    */
  94:   public abstract String getDisplayName(String id, boolean daylight,
  95:                     int style, Locale locale);
  96: 
  97: }