本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}