Java Code Examples for java.text.spi.DecimalFormatSymbolsProvider

The following are top voted examples for showing how to use java.text.spi.DecimalFormatSymbolsProvider. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: JRELocaleProviderAdapter.java   View source code 6 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = AccessController.doPrivileged(
            (PrivilegedAction<DecimalFormatSymbolsProvider>) () ->
                new DecimalFormatSymbolsProviderImpl(
                    getAdapterType(),
                    getLanguageTagSet("FormatData")));

        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 2
Project: openjdk9   File: JRELocaleProviderAdapter.java   View source code 6 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = AccessController.doPrivileged(
            (PrivilegedAction<DecimalFormatSymbolsProvider>) () ->
                new DecimalFormatSymbolsProviderImpl(
                    getAdapterType(),
                    getLanguageTagSet("FormatData")));

        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 3
Project: VarJ   File: DecimalFormatSymbols.java   View source code 6 votes vote down vote up
/**
 * Gets the <code>DecimalFormatSymbols</code> instance for the specified 
 * locale.  This method provides access to <code>DecimalFormatSymbols</code>
 * instances for locales supported by the Java runtime itself as well 
 * as for those supported by installed 
 * {@link java.text.spi.DecimalFormatSymbolsProvider 
 * DecimalFormatSymbolsProvider} implementations.
 * @param locale the desired locale.
 * @return a <code>DecimalFormatSymbols</code> instance.
 * @exception NullPointerException if <code>locale</code> is null
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale) {

    // Check whether a provider can provide an implementation that's closer 
    // to the requested locale than what the Java runtime itself can provide.
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
    if (pool.hasProviders()) {
        DecimalFormatSymbols providersInstance = pool.getLocalizedObject(
                            DecimalFormatSymbolsGetter.INSTANCE, locale);
        if (providersInstance != null) {
            return providersInstance;
        }
    }

    return new DecimalFormatSymbols(locale);
}
 
Example 4
Project: jdk-1.7-annotated   File: DecimalFormatSymbols.java   View source code 6 votes vote down vote up
/**
 * Gets the <code>DecimalFormatSymbols</code> instance for the specified
 * locale.  This method provides access to <code>DecimalFormatSymbols</code>
 * instances for locales supported by the Java runtime itself as well
 * as for those supported by installed
 * {@link java.text.spi.DecimalFormatSymbolsProvider
 * DecimalFormatSymbolsProvider} implementations.
 * @param locale the desired locale.
 * @return a <code>DecimalFormatSymbols</code> instance.
 * @exception NullPointerException if <code>locale</code> is null
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale) {

    // Check whether a provider can provide an implementation that's closer
    // to the requested locale than what the Java runtime itself can provide.
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
    if (pool.hasProviders()) {
        DecimalFormatSymbols providersInstance = pool.getLocalizedObject(
                            DecimalFormatSymbolsGetter.INSTANCE, locale);
        if (providersInstance != null) {
            return providersInstance;
        }
    }

    return new DecimalFormatSymbols(locale);
}
 
Example 5
Project: jdk7-jdk   File: DecimalFormatSymbols.java   View source code 6 votes vote down vote up
/**
 * Gets the <code>DecimalFormatSymbols</code> instance for the specified
 * locale.  This method provides access to <code>DecimalFormatSymbols</code>
 * instances for locales supported by the Java runtime itself as well
 * as for those supported by installed
 * {@link java.text.spi.DecimalFormatSymbolsProvider
 * DecimalFormatSymbolsProvider} implementations.
 * @param locale the desired locale.
 * @return a <code>DecimalFormatSymbols</code> instance.
 * @exception NullPointerException if <code>locale</code> is null
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale) {

    // Check whether a provider can provide an implementation that's closer
    // to the requested locale than what the Java runtime itself can provide.
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
    if (pool.hasProviders()) {
        DecimalFormatSymbols providersInstance = pool.getLocalizedObject(
                            DecimalFormatSymbolsGetter.INSTANCE, locale);
        if (providersInstance != null) {
            return providersInstance;
        }
    }

    return new DecimalFormatSymbols(locale);
}
 
Example 6
Project: openjdk-source-code-learn   File: DecimalFormatSymbols.java   View source code 6 votes vote down vote up
/**
 * Gets the <code>DecimalFormatSymbols</code> instance for the specified
 * locale.  This method provides access to <code>DecimalFormatSymbols</code>
 * instances for locales supported by the Java runtime itself as well
 * as for those supported by installed
 * {@link java.text.spi.DecimalFormatSymbolsProvider
 * DecimalFormatSymbolsProvider} implementations.
 * @param locale the desired locale.
 * @return a <code>DecimalFormatSymbols</code> instance.
 * @exception NullPointerException if <code>locale</code> is null
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale) {

    // Check whether a provider can provide an implementation that's closer
    // to the requested locale than what the Java runtime itself can provide.
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
    if (pool.hasProviders()) {
        DecimalFormatSymbols providersInstance = pool.getLocalizedObject(
                            DecimalFormatSymbolsGetter.INSTANCE, locale);
        if (providersInstance != null) {
            return providersInstance;
        }
    }

    return new DecimalFormatSymbols(locale);
}
 
Example 7
Project: cn1   File: DecimalFormatSymbols.java   View source code 6 votes vote down vote up
/**
 * Return the DecimalFormatSymbols for the specified locale. This method
 * return DecimalFormatSymbols instances for locales supported by the Java
 * runtime and installed DecimalFormatSymbolsProvider implementations.
 * 
 * @param locale
 *            locale for the returned DecimalFormatSymbols instance
 * 
 * @return an instance of DecimalFormatSymbols
 * 
 * @exception NullPointerException
 *                if locale is null
 * 
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale) {
    if (null == locale) {
        throw new NullPointerException();
    }

    if (buildinLocales == null) {
        initBuildInLocales(com.ibm.icu.text.DecimalFormatSymbols
                .getAvailableLocales());
    }

    if (buildinLocales.contains(locale)) {
        return new DecimalFormatSymbols(locale);
    }

    DecimalFormatSymbolsProvider provider = (DecimalFormatSymbolsProvider) LocaleServiceProviderLoader
            .getProviderByLocale(providersCache, locale,
                    PROVIDER_CONFIGURATION_FILE_NAME);

    if (provider != null) {
        return provider.getInstance(locale);
    }
    // return DecimalFormatSymbols using default locale
    return new DecimalFormatSymbols();
}
 
Example 8
Project: openjdk-jdk7u-jdk   File: DecimalFormatSymbols.java   View source code 6 votes vote down vote up
/**
 * Gets the <code>DecimalFormatSymbols</code> instance for the specified
 * locale.  This method provides access to <code>DecimalFormatSymbols</code>
 * instances for locales supported by the Java runtime itself as well
 * as for those supported by installed
 * {@link java.text.spi.DecimalFormatSymbolsProvider
 * DecimalFormatSymbolsProvider} implementations.
 * @param locale the desired locale.
 * @return a <code>DecimalFormatSymbols</code> instance.
 * @exception NullPointerException if <code>locale</code> is null
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale) {

    // Check whether a provider can provide an implementation that's closer
    // to the requested locale than what the Java runtime itself can provide.
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
    if (pool.hasProviders()) {
        DecimalFormatSymbols providersInstance = pool.getLocalizedObject(
                            DecimalFormatSymbolsGetter.INSTANCE, locale);
        if (providersInstance != null) {
            return providersInstance;
        }
    }

    return new DecimalFormatSymbols(locale);
}
 
Example 9
Project: openjdk-icedtea7   File: DecimalFormatSymbols.java   View source code 6 votes vote down vote up
/**
 * Gets the <code>DecimalFormatSymbols</code> instance for the specified
 * locale.  This method provides access to <code>DecimalFormatSymbols</code>
 * instances for locales supported by the Java runtime itself as well
 * as for those supported by installed
 * {@link java.text.spi.DecimalFormatSymbolsProvider
 * DecimalFormatSymbolsProvider} implementations.
 * @param locale the desired locale.
 * @return a <code>DecimalFormatSymbols</code> instance.
 * @exception NullPointerException if <code>locale</code> is null
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale) {

    // Check whether a provider can provide an implementation that's closer
    // to the requested locale than what the Java runtime itself can provide.
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
    if (pool.hasProviders()) {
        DecimalFormatSymbols providersInstance = pool.getLocalizedObject(
                            DecimalFormatSymbolsGetter.INSTANCE, locale);
        if (providersInstance != null) {
            return providersInstance;
        }
    }

    return new DecimalFormatSymbols(locale);
}
 
Example 10
Project: OpenJSharp   File: JRELocaleProviderAdapter.java   View source code 5 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 11
Project: jdk8u-jdk   File: JRELocaleProviderAdapter.java   View source code 5 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 12
Project: openjdk-jdk10   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
/**
 * Initializes the symbols from the FormatData resource bundle.
 */
private void initialize( Locale locale ) {
    this.locale = locale;

    // get resource bundle data
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
    // Avoid potential recursions
    if (!(adapter instanceof ResourceBundleBasedAdapter)) {
        adapter = LocaleProviderAdapter.getResourceBundleBased();
    }
    Object[] data = adapter.getLocaleResources(locale).getDecimalFormatSymbolsData();
    String[] numberElements = (String[]) data[0];

    decimalSeparator = numberElements[0].charAt(0);
    groupingSeparator = numberElements[1].charAt(0);
    patternSeparator = numberElements[2].charAt(0);
    percent = numberElements[3].charAt(0);
    zeroDigit = numberElements[4].charAt(0); //different for Arabic,etc.
    digit = numberElements[5].charAt(0);
    minusSign = numberElements[6].charAt(0);
    exponential = numberElements[7].charAt(0);
    exponentialSeparator = numberElements[7]; //string representation new since 1.6
    perMill = numberElements[8].charAt(0);
    infinity  = numberElements[9];
    NaN = numberElements[10];

    // maybe filled with previously cached values, or null.
    intlCurrencySymbol = (String) data[1];
    currencySymbol = (String) data[2];

    // Currently the monetary decimal separator is the same as the
    // standard decimal separator for all locales that we support.
    // If that changes, add a new entry to NumberElements.
    monetarySeparator = decimalSeparator;
}
 
Example 13
Project: openjdk9   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
/**
 * Initializes the symbols from the FormatData resource bundle.
 */
private void initialize( Locale locale ) {
    this.locale = locale;

    // get resource bundle data
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
    // Avoid potential recursions
    if (!(adapter instanceof ResourceBundleBasedAdapter)) {
        adapter = LocaleProviderAdapter.getResourceBundleBased();
    }
    Object[] data = adapter.getLocaleResources(locale).getDecimalFormatSymbolsData();
    String[] numberElements = (String[]) data[0];

    decimalSeparator = numberElements[0].charAt(0);
    groupingSeparator = numberElements[1].charAt(0);
    patternSeparator = numberElements[2].charAt(0);
    percent = numberElements[3].charAt(0);
    zeroDigit = numberElements[4].charAt(0); //different for Arabic,etc.
    digit = numberElements[5].charAt(0);
    minusSign = numberElements[6].charAt(0);
    exponential = numberElements[7].charAt(0);
    exponentialSeparator = numberElements[7]; //string representation new since 1.6
    perMill = numberElements[8].charAt(0);
    infinity  = numberElements[9];
    NaN = numberElements[10];

    // maybe filled with previously cached values, or null.
    intlCurrencySymbol = (String) data[1];
    currencySymbol = (String) data[2];

    // Currently the monetary decimal separator is the same as the
    // standard decimal separator for all locales that we support.
    // If that changes, add a new entry to NumberElements.
    monetarySeparator = decimalSeparator;
}
 
Example 14
Project: jdk8u_jdk   File: JRELocaleProviderAdapter.java   View source code 5 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 15
Project: lookaside_java-1.8.0-openjdk   File: JRELocaleProviderAdapter.java   View source code 5 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 16
Project: javify   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
/**
 * Returns a {@link DecimalFormatSymbols} instance for the
 * specified locale obtained from either the runtime itself
 * or one of the installed
 * {@link java.text.spi.DecimalFormatSymbolsProvider} instances.
 *
 * @param locale the locale for which an instance should be
 *               returned.
 * @return a {@link DecimalFormatSymbols} instance for the specified
 *         locale.
 * @throws NullPointerException if <code>locale</code> is
 *                              <code>null</code>.
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale)
{
  try
    {
      if (!locale.equals(Locale.ROOT))
        ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
                                 locale,
                                 ClassLoader.getSystemClassLoader());
      return new DecimalFormatSymbols(locale);
    }
  catch (MissingResourceException x)
    {
      /* This means runtime support for the locale
       * is not available, so we check providers. */
    }
  for (DecimalFormatSymbolsProvider p :
         ServiceLoader.load(DecimalFormatSymbolsProvider.class))
    {
      for (Locale loc : p.getAvailableLocales())
        {
          if (loc.equals(locale))
            {
              DecimalFormatSymbols syms = p.getInstance(locale);
              if (syms != null)
                return syms;
              break;
            }
        }
    }
  return getInstance(LocaleHelper.getFallbackLocale(locale));
}
 
Example 17
Project: jvm-stm   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
/**
  * Returns a {@link DecimalFormatSymbols} instance for the
  * specified locale obtained from either the runtime itself
  * or one of the installed
  * {@link java.text.spi.DecimalFormatSymbolsProvider} instances.
  * 
  * @param locale the locale for which an instance should be
  *               returned.
  * @return a {@link DecimalFormatSymbols} instance for the specified
  *         locale.
  * @throws NullPointerException if <code>locale</code> is
  *                              <code>null</code>.
  * @since 1.6
  */
 public static final DecimalFormatSymbols getInstance(Locale locale)
 {
   try
     {
if (!locale.equals(Locale.ROOT))
  ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
			   locale,
			   ClassLoader.getSystemClassLoader());
return new DecimalFormatSymbols(locale);	
     }
   catch (MissingResourceException x)
     {
/* This means runtime support for the locale
 * is not available, so we check providers. */
     }
   for (DecimalFormatSymbolsProvider p :
   ServiceLoader.load(DecimalFormatSymbolsProvider.class))
     {
for (Locale loc : p.getAvailableLocales())
  {
    if (loc.equals(locale))
      {
	DecimalFormatSymbols syms = p.getInstance(locale);
	if (syms != null)
	  return syms;
	break;
      }
  }
     }
   return getInstance(LocaleHelper.getFallbackLocale(locale));
 }
 
Example 18
Project: VarJ   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
public DecimalFormatSymbols getObject(
                        DecimalFormatSymbolsProvider decimalFormatSymbolsProvider, 
                        Locale locale, 
                        String key,
                        Object... params) {
    assert params.length == 0;
    return decimalFormatSymbolsProvider.getInstance(locale);
}
 
Example 19
Project: jdk-1.7-annotated   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
public DecimalFormatSymbols getObject(
                        DecimalFormatSymbolsProvider decimalFormatSymbolsProvider,
                        Locale locale,
                        String key,
                        Object... params) {
    assert params.length == 0;
    return decimalFormatSymbolsProvider.getInstance(locale);
}
 
Example 20
Project: infobip-open-jdk-8   File: JRELocaleProviderAdapter.java   View source code 5 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 21
Project: jdk8u-dev-jdk   File: JRELocaleProviderAdapter.java   View source code 5 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 22
Project: jdk7-jdk   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
public DecimalFormatSymbols getObject(
                        DecimalFormatSymbolsProvider decimalFormatSymbolsProvider,
                        Locale locale,
                        String key,
                        Object... params) {
    assert params.length == 0;
    return decimalFormatSymbolsProvider.getInstance(locale);
}
 
Example 23
Project: openjdk-source-code-learn   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
public DecimalFormatSymbols getObject(
                        DecimalFormatSymbolsProvider decimalFormatSymbolsProvider,
                        Locale locale,
                        String key,
                        Object... params) {
    assert params.length == 0;
    return decimalFormatSymbolsProvider.getInstance(locale);
}
 
Example 24
Project: OLD-OpenJDK8   File: JRELocaleProviderAdapter.java   View source code 5 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    if (decimalFormatSymbolsProvider == null) {
        DecimalFormatSymbolsProvider provider = new DecimalFormatSymbolsProviderImpl(getAdapterType(), getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (decimalFormatSymbolsProvider == null) {
                decimalFormatSymbolsProvider = provider;
            }
        }
    }
    return decimalFormatSymbolsProvider;
}
 
Example 25
Project: JamVM-PH   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
/**
  * Returns a {@link DecimalFormatSymbols} instance for the
  * specified locale obtained from either the runtime itself
  * or one of the installed
  * {@link java.text.spi.DecimalFormatSymbolsProvider} instances.
  * 
  * @param locale the locale for which an instance should be
  *               returned.
  * @return a {@link DecimalFormatSymbols} instance for the specified
  *         locale.
  * @throws NullPointerException if <code>locale</code> is
  *                              <code>null</code>.
  * @since 1.6
  */
 public static final DecimalFormatSymbols getInstance(Locale locale)
 {
   try
     {
if (!locale.equals(Locale.ROOT))
  ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
			   locale,
			   ClassLoader.getSystemClassLoader());
return new DecimalFormatSymbols(locale);	
     }
   catch (MissingResourceException x)
     {
/* This means runtime support for the locale
 * is not available, so we check providers. */
     }
   for (DecimalFormatSymbolsProvider p :
   ServiceLoader.load(DecimalFormatSymbolsProvider.class))
     {
for (Locale loc : p.getAvailableLocales())
  {
    if (loc.equals(locale))
      {
	DecimalFormatSymbols syms = p.getInstance(locale);
	if (syms != null)
	  return syms;
	break;
      }
  }
     }
   return getInstance(LocaleHelper.getFallbackLocale(locale));
 }
 
Example 26
Project: openjdk-jdk7u-jdk   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
public DecimalFormatSymbols getObject(
                        DecimalFormatSymbolsProvider decimalFormatSymbolsProvider,
                        Locale locale,
                        String key,
                        Object... params) {
    assert params.length == 0;
    return decimalFormatSymbolsProvider.getInstance(locale);
}
 
Example 27
Project: classpath   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
/**
 * Returns a {@link DecimalFormatSymbols} instance for the
 * specified locale obtained from either the runtime itself
 * or one of the installed
 * {@link java.text.spi.DecimalFormatSymbolsProvider} instances.
 *
 * @param locale the locale for which an instance should be
 *               returned.
 * @return a {@link DecimalFormatSymbols} instance for the specified
 *         locale.
 * @throws NullPointerException if <code>locale</code> is
 *                              <code>null</code>.
 * @since 1.6
 */
public static final DecimalFormatSymbols getInstance(Locale locale)
{
  try
    {
      if (!locale.equals(Locale.ROOT))
        ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
                                 locale,
                                 ClassLoader.getSystemClassLoader());
      return new DecimalFormatSymbols(locale);
    }
  catch (MissingResourceException x)
    {
      /* This means runtime support for the locale
       * is not available, so we check providers. */
    }
  for (DecimalFormatSymbolsProvider p :
         ServiceLoader.load(DecimalFormatSymbolsProvider.class))
    {
      for (Locale loc : p.getAvailableLocales())
        {
          if (loc.equals(locale))
            {
              DecimalFormatSymbols syms = p.getInstance(locale);
              if (syms != null)
                return syms;
              break;
            }
        }
    }
  return getInstance(LocaleHelper.getFallbackLocale(locale));
}
 
Example 28
Project: openjdk-icedtea7   File: DecimalFormatSymbols.java   View source code 5 votes vote down vote up
public DecimalFormatSymbols getObject(
                        DecimalFormatSymbolsProvider decimalFormatSymbolsProvider,
                        Locale locale,
                        String key,
                        Object... params) {
    assert params.length == 0;
    return decimalFormatSymbolsProvider.getInstance(locale);
}
 
Example 29
Project: OpenJSharp   File: AuxLocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example 30
Project: OpenJSharp   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}
 
Example 31
Project: OpenJSharp   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
Example 32
Project: jdk8u-jdk   File: AuxLocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example 33
Project: jdk8u-jdk   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}
 
Example 34
Project: jdk8u-jdk   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
Example 35
Project: openjdk-jdk10   File: AuxLocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example 36
Project: openjdk-jdk10   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}
 
Example 37
Project: openjdk-jdk10   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
Example 38
Project: openjdk9   File: AuxLocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example 39
Project: openjdk9   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}
 
Example 40
Project: openjdk9   File: SPILocaleProviderAdapter.java   View source code 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}