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


Java CollatorProvider类代码示例

本文整理汇总了Java中java.text.spi.CollatorProvider的典型用法代码示例。如果您正苦于以下问题:Java CollatorProvider类的具体用法?Java CollatorProvider怎么用?Java CollatorProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getCollatorProvider

import java.text.spi.CollatorProvider; //导入依赖的package包/类
@Override
public CollatorProvider getCollatorProvider() {
    if (collatorProvider == null) {
        CollatorProvider provider = AccessController.doPrivileged(
            (PrivilegedAction<CollatorProvider>) () ->
                new CollatorProviderImpl(
                    getAdapterType(),
                    getLanguageTagSet("CollationData")));

        synchronized (this) {
            if (collatorProvider == null) {
                collatorProvider = provider;
            }
        }
    }
    return collatorProvider;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:JRELocaleProviderAdapter.java

示例2: getObject

import java.text.spi.CollatorProvider; //导入依赖的package包/类
public Collator getObject(CollatorProvider collatorProvider,
                        Locale locale, 
                        String key,
                        Object... params) {
    assert params.length == 1;
    Collator result = collatorProvider.getInstance(locale);
    if (result != null) {
        // put this Collator instance in the cache for two locales, one
        // is for the desired locale, and the other is for the actual
        // locale where the provider is found, which may be a fall back locale.
        cache.put((Locale)params[0], result);
        cache.put(locale, result);
        return (Collator)result.clone();
    }
    
    return null;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:18,代码来源:Collator.java

示例3: getObject

import java.text.spi.CollatorProvider; //导入依赖的package包/类
public Collator getObject(CollatorProvider collatorProvider,
                        Locale locale,
                        String key,
                        Object... params) {
    assert params.length == 1;
    Collator result = collatorProvider.getInstance(locale);
    if (result != null) {
        // put this Collator instance in the cache for two locales, one
        // is for the desired locale, and the other is for the actual
        // locale where the provider is found, which may be a fall back locale.
        cache.put((Locale)params[0], result);
        cache.put(locale, result);
        return (Collator)result.clone();
    }

    return null;
}
 
开发者ID:ZhaoX,项目名称:jdk-1.7-annotated,代码行数:18,代码来源:Collator.java

示例4: getInstance

import java.text.spi.CollatorProvider; //导入依赖的package包/类
/**
 * Gets the Collator for the desired locale.
 * @param desiredLocale the desired locale.
 * @return the Collator for the desired locale.
 * @see java.util.Locale
 * @see java.util.ResourceBundle
 */
public static Collator getInstance(Locale desiredLocale) {
    SoftReference<Collator> ref = cache.get(desiredLocale);
    Collator result = (ref != null) ? ref.get() : null;
    if (result == null) {
        LocaleProviderAdapter adapter;
        adapter = LocaleProviderAdapter.getAdapter(CollatorProvider.class,
                                                   desiredLocale);
        CollatorProvider provider = adapter.getCollatorProvider();
        result = provider.getInstance(desiredLocale);
        if (result == null) {
            result = LocaleProviderAdapter.forJRE()
                         .getCollatorProvider().getInstance(desiredLocale);
        }
        while (true) {
            if (ref != null) {
                // Remove the empty SoftReference if any
                cache.remove(desiredLocale, ref);
            }
            ref = cache.putIfAbsent(desiredLocale, new SoftReference<>(result));
            if (ref == null) {
                break;
            }
            Collator cachedColl = ref.get();
            if (cachedColl != null) {
                result = cachedColl;
                break;
            }
        }
    }
    return (Collator) result.clone(); // make the world safe
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:Collator.java

示例5: getCollatorProvider

import java.text.spi.CollatorProvider; //导入依赖的package包/类
@Override
public CollatorProvider getCollatorProvider() {
    if (collatorProvider == null) {
        CollatorProvider provider = new CollatorProviderImpl(getAdapterType(),
                                            getLanguageTagSet("CollationData"));
        synchronized (this) {
            if (collatorProvider == null) {
                collatorProvider = provider;
            }
        }
    }
    return collatorProvider;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:JRELocaleProviderAdapter.java

示例6: getCollatorProvider

import java.text.spi.CollatorProvider; //导入依赖的package包/类
@Override
public CollatorProvider getCollatorProvider() {
    return getLocaleServiceProvider(CollatorProvider.class);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:AuxLocaleProviderAdapter.java

示例7: addImpl

import java.text.spi.CollatorProvider; //导入依赖的package包/类
@Override
public void addImpl(CollatorProvider impl) {
    for (Locale l : impl.getAvailableLocales()) {
        map.putIfAbsent(l, impl);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:SPILocaleProviderAdapter.java

示例8: getImpl

import java.text.spi.CollatorProvider; //导入依赖的package包/类
@Override
public CollatorProvider getImpl(Locale locale) {
    return SPILocaleProviderAdapter.getImpl(map, locale);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:SPILocaleProviderAdapter.java

示例9: getCollatorProvider

import java.text.spi.CollatorProvider; //导入依赖的package包/类
@Override
public CollatorProvider getCollatorProvider() {
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:CLDRLocaleProviderAdapter.java


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