java.text.spi.NumberFormatProvider Java Examples

The following examples show how to use java.text.spi.NumberFormatProvider. 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 Project: jdk1.8-source-analysis   Author: raysonfang   File: NumberFormat.java    License: Apache License 2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #2
Source Project: Java8CN   Author: Java8-CNAPI-Team   File: NumberFormat.java    License: Apache License 2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #3
Source Project: hottub   Author: dsrg-uoft   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #4
Source Project: openjdk-8   Author: bpupadhyaya   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #5
Source Project: openjdk-8-source   Author: keerath   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #6
Source Project: jdk8u60   Author: chenghanpeng   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #7
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #8
Source Project: jdk8u-jdk   Author: frohoff   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #9
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #10
Source Project: Bytecoder   Author: mirkosertic   File: NumberFormat.java    License: Apache License 2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, Style formatStyle,
                                        int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    case COMPACTSTYLE:
        numberFormat = provider.getCompactNumberInstance(locale, formatStyle);
        break;
    }
    return numberFormat;
}
 
Example #11
Source Project: Bytecoder   Author: mirkosertic   File: JRELocaleProviderAdapter.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public NumberFormatProvider getNumberFormatProvider() {
    if (numberFormatProvider == null) {
        NumberFormatProvider provider = AccessController.doPrivileged(
            (PrivilegedAction<NumberFormatProvider>) () ->
                new NumberFormatProviderImpl(
                    getAdapterType(),
                    getLanguageTagSet("FormatData")));

        synchronized (this) {
            if (numberFormatProvider == null) {
                numberFormatProvider = provider;
            }
        }
    }
    return numberFormatProvider;
}
 
Example #12
Source Project: jdk-1.7-annotated   Author: ZhaoX   File: NumberFormat.java    License: Apache License 2.0 6 votes vote down vote up
public NumberFormat getObject(NumberFormatProvider numberFormatProvider,
                        Locale locale,
                        String key,
                        Object... params) {
    assert params.length == 1;
    int choice = (Integer)params[0];

    switch (choice) {
    case NUMBERSTYLE:
        return numberFormatProvider.getNumberInstance(locale);
    case PERCENTSTYLE:
        return numberFormatProvider.getPercentInstance(locale);
    case CURRENCYSTYLE:
        return numberFormatProvider.getCurrencyInstance(locale);
    case INTEGERSTYLE:
        return numberFormatProvider.getIntegerInstance(locale);
    default:
        assert false : choice;
    }

    return null;
}
 
Example #13
Source Project: jdk8u-dev-jdk   Author: frohoff   File: NumberFormat.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static NumberFormat getInstance(LocaleProviderAdapter adapter,
                                        Locale locale, int choice) {
    NumberFormatProvider provider = adapter.getNumberFormatProvider();
    NumberFormat numberFormat = null;
    switch (choice) {
    case NUMBERSTYLE:
        numberFormat = provider.getNumberInstance(locale);
        break;
    case PERCENTSTYLE:
        numberFormat = provider.getPercentInstance(locale);
        break;
    case CURRENCYSTYLE:
        numberFormat = provider.getCurrencyInstance(locale);
        break;
    case INTEGERSTYLE:
        numberFormat = provider.getIntegerInstance(locale);
        break;
    }
    return numberFormat;
}
 
Example #14
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: NumberFormat.java    License: Apache License 2.0 5 votes vote down vote up
private static NumberFormat getInstance(Locale desiredLocale,
                                       int choice) {
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               desiredLocale);
    NumberFormat numberFormat = getInstance(adapter, desiredLocale, choice);
    if (numberFormat == null) {
        numberFormat = getInstance(LocaleProviderAdapter.forJRE(),
                                   desiredLocale, choice);
    }
    return numberFormat;
}
 
Example #15
Source Project: jdk8u-jdk   Author: frohoff   File: NumberFormat.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static NumberFormat getInstance(Locale desiredLocale,
                                       int choice) {
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               desiredLocale);
    NumberFormat numberFormat = getInstance(adapter, desiredLocale, choice);
    if (numberFormat == null) {
        numberFormat = getInstance(LocaleProviderAdapter.forJRE(),
                                   desiredLocale, choice);
    }
    return numberFormat;
}
 
Example #16
Source Project: jdk8u-jdk   Author: frohoff   File: JSpinner.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static String getDefaultPattern(Locale locale) {
    // Get the pattern for the default locale.
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               locale);
    LocaleResources lr = adapter.getLocaleResources(locale);
    if (lr == null) {
        lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
    }
    String[] all = lr.getNumberPatterns();
    return all[0];
}
 
Example #17
Source Project: dragonwell8_jdk   Author: alibaba   File: JRELocaleProviderAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public NumberFormatProvider getNumberFormatProvider() {
    if (numberFormatProvider == null) {
        NumberFormatProvider provider = new NumberFormatProviderImpl(getAdapterType(),
                                                    getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (numberFormatProvider == null) {
                numberFormatProvider = provider;
            }
        }
    }
    return numberFormatProvider;
}
 
Example #18
Source Project: openjdk-8-source   Author: keerath   File: JRELocaleProviderAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public NumberFormatProvider getNumberFormatProvider() {
    if (numberFormatProvider == null) {
        NumberFormatProvider provider = new NumberFormatProviderImpl(getAdapterType(),
                                                    getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (numberFormatProvider == null) {
                numberFormatProvider = provider;
            }
        }
    }
    return numberFormatProvider;
}
 
Example #19
Source Project: dragonwell8_jdk   Author: alibaba   File: JSpinner.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static String getDefaultPattern(Locale locale) {
    // Get the pattern for the default locale.
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               locale);
    LocaleResources lr = adapter.getLocaleResources(locale);
    if (lr == null) {
        lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
    }
    String[] all = lr.getNumberPatterns();
    return all[0];
}
 
Example #20
Source Project: hottub   Author: dsrg-uoft   File: JRELocaleProviderAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public NumberFormatProvider getNumberFormatProvider() {
    if (numberFormatProvider == null) {
        NumberFormatProvider provider = new NumberFormatProviderImpl(getAdapterType(),
                                                    getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (numberFormatProvider == null) {
                numberFormatProvider = provider;
            }
        }
    }
    return numberFormatProvider;
}
 
Example #21
Source Project: TencentKona-8   Author: Tencent   File: NumberFormat.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static NumberFormat getInstance(Locale desiredLocale,
                                       int choice) {
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               desiredLocale);
    NumberFormat numberFormat = getInstance(adapter, desiredLocale, choice);
    if (numberFormat == null) {
        numberFormat = getInstance(LocaleProviderAdapter.forJRE(),
                                   desiredLocale, choice);
    }
    return numberFormat;
}
 
Example #22
Source Project: TencentKona-8   Author: Tencent   File: JRELocaleProviderAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public NumberFormatProvider getNumberFormatProvider() {
    if (numberFormatProvider == null) {
        NumberFormatProvider provider = new NumberFormatProviderImpl(getAdapterType(),
                                                    getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (numberFormatProvider == null) {
                numberFormatProvider = provider;
            }
        }
    }
    return numberFormatProvider;
}
 
Example #23
Source Project: openjdk-8-source   Author: keerath   File: NumberFormat.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static NumberFormat getInstance(Locale desiredLocale,
                                       int choice) {
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               desiredLocale);
    NumberFormat numberFormat = getInstance(adapter, desiredLocale, choice);
    if (numberFormat == null) {
        numberFormat = getInstance(LocaleProviderAdapter.forJRE(),
                                   desiredLocale, choice);
    }
    return numberFormat;
}
 
Example #24
Source Project: jdk8u60   Author: chenghanpeng   File: NumberFormat.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static NumberFormat getInstance(Locale desiredLocale,
                                       int choice) {
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               desiredLocale);
    NumberFormat numberFormat = getInstance(adapter, desiredLocale, choice);
    if (numberFormat == null) {
        numberFormat = getInstance(LocaleProviderAdapter.forJRE(),
                                   desiredLocale, choice);
    }
    return numberFormat;
}
 
Example #25
Source Project: jdk8u60   Author: chenghanpeng   File: JRELocaleProviderAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public NumberFormatProvider getNumberFormatProvider() {
    if (numberFormatProvider == null) {
        NumberFormatProvider provider = new NumberFormatProviderImpl(getAdapterType(),
                                                    getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (numberFormatProvider == null) {
                numberFormatProvider = provider;
            }
        }
    }
    return numberFormatProvider;
}
 
Example #26
Source Project: jdk8u60   Author: chenghanpeng   File: JSpinner.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static String getDefaultPattern(Locale locale) {
    // Get the pattern for the default locale.
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               locale);
    LocaleResources lr = adapter.getLocaleResources(locale);
    if (lr == null) {
        lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
    }
    String[] all = lr.getNumberPatterns();
    return all[0];
}
 
Example #27
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: JSpinner.java    License: MIT License 5 votes vote down vote up
private static String getDefaultPattern(Locale locale) {
    // Get the pattern for the default locale.
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               locale);
    LocaleResources lr = adapter.getLocaleResources(locale);
    if (lr == null) {
        lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
    }
    String[] all = lr.getNumberPatterns();
    return all[0];
}
 
Example #28
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: JSpinner.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static String getDefaultPattern(Locale locale) {
    // Get the pattern for the default locale.
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               locale);
    LocaleResources lr = adapter.getLocaleResources(locale);
    if (lr == null) {
        lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
    }
    String[] all = lr.getNumberPatterns();
    return all[0];
}
 
Example #29
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: JRELocaleProviderAdapter.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public NumberFormatProvider getNumberFormatProvider() {
    if (numberFormatProvider == null) {
        NumberFormatProvider provider = new NumberFormatProviderImpl(getAdapterType(),
                                                    getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (numberFormatProvider == null) {
                numberFormatProvider = provider;
            }
        }
    }
    return numberFormatProvider;
}
 
Example #30
Source Project: jdk8u_jdk   Author: JetBrains   File: JSpinner.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static String getDefaultPattern(Locale locale) {
    // Get the pattern for the default locale.
    LocaleProviderAdapter adapter;
    adapter = LocaleProviderAdapter.getAdapter(NumberFormatProvider.class,
                                               locale);
    LocaleResources lr = adapter.getLocaleResources(locale);
    if (lr == null) {
        lr = LocaleProviderAdapter.forJRE().getLocaleResources(locale);
    }
    String[] all = lr.getNumberPatterns();
    return all[0];
}