< prev index next >

src/java.base/share/classes/java/util/spi/LocaleNameProvider.java

Print this page
rev 47733 : 8176841: Additional Unicode Language-Tag Extensions
8189134: New system properties for the default Locale extensions
Reviewed-by:

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, 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

@@ -24,10 +24,11 @@
  */
 
 package java.util.spi;
 
 import java.util.Locale;
+import java.util.Objects;
 
 /**
  * An abstract class for service providers that
  * provide localized names for the
  * {@link java.util.Locale Locale} class.

@@ -139,6 +140,56 @@
      *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
      *     getAvailableLocales()}.
      * @see java.util.Locale#getDisplayVariant(java.util.Locale)
      */
     public abstract String getDisplayVariant(String variant, Locale locale);
+
+    /**
+     * Returns a localized name for the given
+     * <a href="../Locale.html#def_locale_extension">Unicode extension</a> key,
+     * and the given locale that is appropriate for display to the user.
+     * If the name returned cannot be localized according to <code>locale</code>,
+     * this method returns null.
+     * @implSpec the default implementation returns <code>null</code>.
+     * @param key the Unicode Extension key, not null.
+     * @param locale the desired locale, not null.
+     * @return the name of the given key string for the specified locale,
+     *  or null if it's not available.
+     * @exception NullPointerException if <code>key</code> or <code>locale</code> is null
+     * @exception IllegalArgumentException if <code>locale</code> isn't
+     *     one of the locales returned from
+     *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
+     *     getAvailableLocales()}.
+     * @since 10
+     */
+    public String getDisplayUnicodeExtensionKey(String key, Locale locale) {
+        Objects.requireNonNull(key);
+        Objects.requireNonNull(locale);
+        return null;
+    }
+
+    /**
+     * Returns a localized name for the given
+     * <a href="../Locale.html#def_locale_extension">Unicode extension</a> type,
+     * and the given locale that is appropriate for display to the user.
+     * If the name returned cannot be localized according to <code>locale</code>,
+     * this method returns null.
+     * @implSpec the default implementation returns <code>null</code>.
+     * @param type the Unicode Extension type, not null. 
+     * @param key the Unicode Extension key for this <code>type</code>, not null.
+     * @param locale the desired locale, not null.
+     * @return the name of the given type string for the specified locale,
+     *  or null if it's not available.
+     * @exception NullPointerException if <code>key</code>, <code>type</code> or <code>locale</code> is null
+     * @exception IllegalArgumentException if <code>locale</code> isn't
+     *     one of the locales returned from
+     *     {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
+     *     getAvailableLocales()}.
+     * @since 10
+     */
+    public String getDisplayUnicodeExtensionType(String type, String key, Locale locale) {
+        Objects.requireNonNull(type);
+        Objects.requireNonNull(key);
+        Objects.requireNonNull(locale);
+        return null;
+    }
 }
< prev index next >