Java Code Examples for java.util.spi.LocaleServiceProvider#isSupportedLocale()

The following examples show how to use java.util.spi.LocaleServiceProvider#isSupportedLocale() . 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: LocaleServiceProviderPool.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 2
Source File: LocaleServiceProviderPool.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 3
Source File: LocaleServiceProviderPool.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 4
Source File: LocaleServiceProviderPool.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 5
Source File: LocaleServiceProviderPool.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 6
Source File: LocaleServiceProviderPool.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 7
Source File: LocaleServiceProviderPool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 8
Source File: LocaleServiceProviderPool.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 9
Source File: LocaleServiceProviderPool.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleProviderAdapter.Type> findProviders(Locale locale) {
    List<LocaleProviderAdapter.Type> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleServiceProvider lsp = providers.get(type);
            if (lsp != null) {
                if (lsp.isSupportedLocale(locale)) {
                    if (providersList == null) {
                        providersList = new ArrayList<>(2);
                    }
                    providersList.add(type);

                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleProviderAdapter.Type> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
        return providersList;
    }
 
Example 10
Source File: LocaleProviderAdapter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}
 
Example 11
Source File: LocaleProviderAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}
 
Example 12
Source File: LocaleProviderAdapter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        if (adapter != null) {
            LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
            if (provider != null) {
                if (provider.isSupportedLocale(locale)) {
                    return adapter;
                }
            }
        }
    }
    return null;
}
 
Example 13
Source File: LocaleServiceProviderPool.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleServiceProvider> findProviders(Locale locale, boolean isObjectProvider) {
    List<LocaleServiceProvider> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleProviderAdapter lda = LocaleProviderAdapter.forType(type);
            if (lda != null) {
                LocaleServiceProvider lsp = lda.getLocaleServiceProvider(providerClass);
                if (lsp != null) {
                    if (lsp.isSupportedLocale(locale)) {
                        if (providersList == null) {
                            providersList = new ArrayList<>(2);
                        }
                        providersList.add(lsp);
                        if (isObjectProvider) {
                            break;
                        }
                    }
                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleServiceProvider> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
    return providersList;
}
 
Example 14
Source File: LocaleServiceProviderPool.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the list of locale service provider instances that support
 * the specified locale.
 *
 * @param locale the given locale
 * @return the list of locale data adapter types
 */
private List<LocaleServiceProvider> findProviders(Locale locale, boolean isObjectProvider) {
    List<LocaleServiceProvider> providersList = providersCache.get(locale);
    if (providersList == null) {
        for (LocaleProviderAdapter.Type type : LocaleProviderAdapter.getAdapterPreference()) {
            LocaleProviderAdapter lda = LocaleProviderAdapter.forType(type);
            if (lda != null) {
                LocaleServiceProvider lsp = lda.getLocaleServiceProvider(providerClass);
                if (lsp != null) {
                    if (lsp.isSupportedLocale(locale)) {
                        if (providersList == null) {
                            providersList = new ArrayList<>(2);
                        }
                        providersList.add(lsp);
                        if (isObjectProvider) {
                            break;
                        }
                    }
                }
            }
        }
        if (providersList == null) {
            providersList = NULL_LIST;
        }
        List<LocaleServiceProvider> val = providersCache.putIfAbsent(locale, providersList);
        if (val != null) {
            providersList = val;
        }
    }
    return providersList;
}
 
Example 15
Source File: LocaleProviderAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}
 
Example 16
Source File: LocaleProviderAdapter.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}
 
Example 17
Source File: LocaleProviderAdapter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}
 
Example 18
Source File: LocaleProviderAdapter.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}
 
Example 19
Source File: LocaleProviderAdapter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}
 
Example 20
Source File: LocaleProviderAdapter.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static LocaleProviderAdapter findAdapter(Class<? extends LocaleServiceProvider> providerClass,
                                             Locale locale) {
    for (Type type : getAdapterPreference()) {
        LocaleProviderAdapter adapter = forType(type);
        LocaleServiceProvider provider = adapter.getLocaleServiceProvider(providerClass);
        if (provider != null) {
            if (provider.isSupportedLocale(locale)) {
                return adapter;
            }
        }
    }
    return null;
}