当前位置: 首页>>代码示例>>Java>>正文


Java LocaleServiceProvider.isSupportedLocale方法代码示例

本文整理汇总了Java中java.util.spi.LocaleServiceProvider.isSupportedLocale方法的典型用法代码示例。如果您正苦于以下问题:Java LocaleServiceProvider.isSupportedLocale方法的具体用法?Java LocaleServiceProvider.isSupportedLocale怎么用?Java LocaleServiceProvider.isSupportedLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.spi.LocaleServiceProvider的用法示例。


在下文中一共展示了LocaleServiceProvider.isSupportedLocale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findProviders

import java.util.spi.LocaleServiceProvider; //导入方法依赖的package包/类
/**
 * 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;
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:LocaleServiceProviderPool.java

示例2: findAdapter

import java.util.spi.LocaleServiceProvider; //导入方法依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:LocaleProviderAdapter.java

示例3: findAdapter

import java.util.spi.LocaleServiceProvider; //导入方法依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:LocaleProviderAdapter.java

示例4: findProviders

import java.util.spi.LocaleServiceProvider; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:LocaleServiceProviderPool.java


注:本文中的java.util.spi.LocaleServiceProvider.isSupportedLocale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。