Package java.util.spi

Class LocaleNameProvider

java.lang.Object
java.util.spi.LocaleServiceProvider
java.util.spi.LocaleNameProvider

public abstract class LocaleNameProvider
extends LocaleServiceProvider
This abstract class should be extended by service providers that provide localized locale names.

Note that Android does not support user-supplied locale service providers.

Since:
1.6
  • Constructor Details

    • LocaleNameProvider

      protected LocaleNameProvider()
      Default constructor, for use by subclasses.
  • Method Details

    • getDisplayLanguage

      public abstract String getDisplayLanguage​(String languageCode, Locale locale)
      Returns the localized name for the given ISO 639 language code.
      Parameters:
      languageCode - an ISO 639 language code
      locale - a locale
      Returns:
      the name or null if unavailable
      Throws:
      NullPointerException - if code == null || locale == null
      IllegalArgumentException - if code or locale is not in a legal format or not available
    • getDisplayCountry

      public abstract String getDisplayCountry​(String countryCode, Locale locale)
      Returns the localized name for the given ISO 3166 country code.
      Parameters:
      countryCode - an ISO 3166 language code
      locale - a locale
      Returns:
      the name or null if unavailable
      Throws:
      NullPointerException - if code == null || locale == null
      IllegalArgumentException - if code or locale is not in a legal format or not available
    • getDisplayVariant

      public abstract String getDisplayVariant​(String variantCode, Locale locale)
      Returns the localized name for the given variant code.
      Parameters:
      variantCode - a variant code
      locale - a locale
      Returns:
      the name or null if unavailable
      Throws:
      NullPointerException - if code == null || locale == null
      IllegalArgumentException - if code or locale is not in a legal format or not available