src/share/classes/java/util/spi/TimeZoneNameProvider.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -75,6 +75,36 @@
      * @exception NullPointerException if <code>ID</code> or <code>locale</code>
      *     is null
      * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
      */
     public abstract String getDisplayName(String ID, boolean daylight, int style, Locale locale);
+
+    /**
+     * Returns a generic name for the given time zone {@code ID} that's suitable
+     * for presentation to the user in the specified {@code locale}. Generic
+     * time zone names are neutral from standard time and daylight saving
+     * time. For example, "PT" is the short generic name of time zone ID {@code
+     * America/Los_Angeles}, while its short standard time and daylight saving
+     * time names are "PST" and "PDT", respectively. Refer to
+     * {@link #getDisplayName(String, boolean, int, Locale) getDisplayName}
+     * for valid time zone IDs.
+     *
+     * <p>The default implementation of this method returns {@code null}.
+     *
+     * @param ID a time zone ID string
+     * @param style either {@link java.util.TimeZone#LONG TimeZone.LONG} or
+     *    {@link java.util.TimeZone#SHORT TimeZone.SHORT}
+     * @param locale the desired locale
+     * @return the human-readable generic name of the given time zone in the
+     *     given locale, or {@code null} if it's not available.
+     * @exception IllegalArgumentException if <code>style</code> is invalid,
+     *     or <code>locale</code> isn't one of the locales returned from
+     *     {@link LocaleServiceProvider#getAvailableLocales()
+     *     getAvailableLocales()}.
+     * @exception NullPointerException if <code>ID</code> or <code>locale</code>
+     *     is {@code null}
+     * @since 1.8
+     */
+    public String getGenericDisplayName(String ID, int style, Locale locale) {
+        return null;
+    }
 }