java.text.spi.DecimalFormatSymbolsProvider Java Examples

The following examples show how to use java.text.spi.DecimalFormatSymbolsProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JRELocaleProviderAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 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
Source File: JRELocaleProviderAdapter.java    From Bytecoder with Apache License 2.0 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
Source File: DecimalFormatSymbols.java    From jdk-1.7-annotated with Apache License 2.0 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
Source File: JRELocaleProviderAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 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 #5
Source File: JRELocaleProviderAdapter.java    From hottub with GNU General Public License v2.0 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 #6
Source File: JRELocaleProviderAdapter.java    From jdk8u60 with GNU General Public License v2.0 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 #7
Source File: JRELocaleProviderAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 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 #8
Source File: JRELocaleProviderAdapter.java    From jdk8u_jdk with GNU General Public License v2.0 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 #9
Source File: JRELocaleProviderAdapter.java    From openjdk-8 with GNU General Public License v2.0 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 #10
Source File: JRELocaleProviderAdapter.java    From TencentKona-8 with GNU General Public License v2.0 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
Source File: JRELocaleProviderAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 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
Source File: JRELocaleProviderAdapter.java    From openjdk-8-source with GNU General Public License v2.0 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 #13
Source File: DecimalFormatSymbols.java    From openjdk-jdk9 with GNU General Public License v2.0 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
Source File: AuxLocaleProviderAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example #15
Source File: AuxLocaleProviderAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example #16
Source File: AuxLocaleProviderAdapter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example #17
Source File: SPILocaleProviderAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}
 
Example #18
Source File: SPILocaleProviderAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
Example #19
Source File: SPILocaleProviderAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
Example #20
Source File: SPILocaleProviderAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
Example #21
Source File: SPILocaleProviderAdapter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
Example #22
Source File: AuxLocaleProviderAdapter.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example #23
Source File: AuxLocaleProviderAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example #24
Source File: SPILocaleProviderAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}
 
Example #25
Source File: AuxLocaleProviderAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example #26
Source File: DecimalFormatSymbols.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Initializes the symbols from the FormatData resource bundle.
 */
private void initialize( Locale locale ) {
    this.locale = locale;

    // check for region override
    Locale override = locale.getUnicodeLocaleType("nu") == null ?
        CalendarDataUtility.findRegionOverride(locale) :
        locale;

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

    decimalSeparator = numberElements[0].charAt(0);
    groupingSeparator = numberElements[1].charAt(0);
    patternSeparator = numberElements[2].charAt(0);
    percentText = numberElements[3];
    percent = findNonFormatChar(percentText, '%');
    zeroDigit = numberElements[4].charAt(0); //different for Arabic,etc.
    digit = numberElements[5].charAt(0);
    minusSignText = numberElements[6];
    minusSign = findNonFormatChar(minusSignText, '-');
    exponential = numberElements[7].charAt(0);
    exponentialSeparator = numberElements[7]; //string representation new since 1.6
    perMillText = numberElements[8];
    perMill = findNonFormatChar(perMillText, '\u2030');
    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 #27
Source File: AuxLocaleProviderAdapter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbolsProvider getDecimalFormatSymbolsProvider() {
    return getLocaleServiceProvider(DecimalFormatSymbolsProvider.class);
}
 
Example #28
Source File: SPILocaleProviderAdapter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public Map<Locale, DecimalFormatSymbolsProvider> getDelegateMap() {
    return map;
}
 
Example #29
Source File: SPILocaleProviderAdapter.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@Override
public DecimalFormatSymbols getInstance(Locale locale) {
    locale = CalendarDataUtility.findRegionOverride(locale);
    DecimalFormatSymbolsProvider dfsp = getImpl(locale);
    return dfsp.getInstance(locale);
}
 
Example #30
Source File: SPILocaleProviderAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void addImpl(DecimalFormatSymbolsProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}