< prev index next >

src/java.base/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java

Print this page




  62 
  63     @Override
  64     public boolean isSupportedLocale(Locale locale) {
  65         return LocaleProviderAdapter.isSupportedLocale(locale, type, langtags);
  66     }
  67 
  68     /**
  69      * Returns a name for the given time zone ID that's suitable for
  70      * presentation to the user in the specified locale. The given time
  71      * zone ID is "GMT" or one of the names defined using "Zone" entries
  72      * in the "tz database", a public domain time zone database at
  73      * <a href="ftp://elsie.nci.nih.gov/pub/">ftp://elsie.nci.nih.gov/pub/</a>.
  74      * The data of this database is contained in a file whose name starts with
  75      * "tzdata", and the specification of the data format is part of the zic.8
  76      * man page, which is contained in a file whose name starts with "tzcode".
  77      * <p>
  78      * If <code>daylight</code> is true, the method should return a name
  79      * appropriate for daylight saving time even if the specified time zone
  80      * has not observed daylight saving time in the past.
  81      *
  82      * @param ID a time zone ID string
  83      * @param daylight if true, return the daylight saving name.
  84      * @param style either {@link java.util.TimeZone#LONG TimeZone.LONG} or
  85      *    {@link java.util.TimeZone#SHORT TimeZone.SHORT}
  86      * @param locale the desired locale
  87      * @return the human-readable name of the given time zone in the
  88      *     given locale, or null if it's not available.
  89      * @exception IllegalArgumentException if <code>style</code> is invalid,
  90      *     or <code>locale</code> isn't one of the locales returned from
  91      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
  92      *     getAvailableLocales()}.
  93      * @exception NullPointerException if <code>ID</code> or <code>locale</code>
  94      *     is null
  95      * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
  96      */
  97     @Override
  98     public String getDisplayName(String id, boolean daylight, int style, Locale locale) {
  99         String[] names = getDisplayNameArray(id, locale);
 100         if (Objects.nonNull(names)) {
 101             assert names.length >= 7;
 102             int index = daylight ? 3 : 1;




  62 
  63     @Override
  64     public boolean isSupportedLocale(Locale locale) {
  65         return LocaleProviderAdapter.isSupportedLocale(locale, type, langtags);
  66     }
  67 
  68     /**
  69      * Returns a name for the given time zone ID that's suitable for
  70      * presentation to the user in the specified locale. The given time
  71      * zone ID is "GMT" or one of the names defined using "Zone" entries
  72      * in the "tz database", a public domain time zone database at
  73      * <a href="ftp://elsie.nci.nih.gov/pub/">ftp://elsie.nci.nih.gov/pub/</a>.
  74      * The data of this database is contained in a file whose name starts with
  75      * "tzdata", and the specification of the data format is part of the zic.8
  76      * man page, which is contained in a file whose name starts with "tzcode".
  77      * <p>
  78      * If <code>daylight</code> is true, the method should return a name
  79      * appropriate for daylight saving time even if the specified time zone
  80      * has not observed daylight saving time in the past.
  81      *
  82      * @param id a time zone ID string
  83      * @param daylight if true, return the daylight saving name.
  84      * @param style either {@link java.util.TimeZone#LONG TimeZone.LONG} or
  85      *    {@link java.util.TimeZone#SHORT TimeZone.SHORT}
  86      * @param locale the desired locale
  87      * @return the human-readable name of the given time zone in the
  88      *     given locale, or null if it's not available.
  89      * @exception IllegalArgumentException if <code>style</code> is invalid,
  90      *     or <code>locale</code> isn't one of the locales returned from
  91      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
  92      *     getAvailableLocales()}.
  93      * @exception NullPointerException if <code>ID</code> or <code>locale</code>
  94      *     is null
  95      * @see java.util.TimeZone#getDisplayName(boolean, int, java.util.Locale)
  96      */
  97     @Override
  98     public String getDisplayName(String id, boolean daylight, int style, Locale locale) {
  99         String[] names = getDisplayNameArray(id, locale);
 100         if (Objects.nonNull(names)) {
 101             assert names.length >= 7;
 102             int index = daylight ? 3 : 1;


< prev index next >