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


Java TimeZoneNamesBundle类代码示例

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


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

示例1: getTimeZoneNames

import sun.util.resources.TimeZoneNamesBundle; //导入依赖的package包/类
String[] getTimeZoneNames(String key, int size) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + size + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (data == null || ((names = (String[]) data.get()) == null)) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key, size);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:LocaleResources.java

示例2: getZoneStrings

import sun.util.resources.TimeZoneNamesBundle; //导入依赖的package包/类
String[][] getZoneStrings() {
    TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
    Set<String> keyset = getZoneIDs();
    // Use a LinkedHashSet to preseve the order
    Set<String[]> value = new LinkedHashSet<>();
    for (String key : keyset) {
        value.add(rb.getStringArray(key));
    }

    // Add aliases data for CLDR
    if (type == LocaleProviderAdapter.Type.CLDR) {
        // Note: TimeZoneNamesBundle creates a String[] on each getStringArray call.
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        for (String alias : aliases.keySet()) {
            if (!keyset.contains(alias)) {
                String tzid = aliases.get(alias);
                if (keyset.contains(tzid)) {
                    String[] val = rb.getStringArray(tzid);
                    val[0] = alias;
                    value.add(val);
                }
            }
        }
    }
    return value.toArray(new String[0][]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:LocaleResources.java

示例3: getTimeZoneNames

import sun.util.resources.TimeZoneNamesBundle; //导入依赖的package包/类
String[] getTimeZoneNames(String key) {
    String[] names = null;
    String cacheKey = TIME_ZONE_NAMES + '.' + key;

    removeEmptyReferences();
    ResourceReference data = cache.get(cacheKey);

    if (Objects.isNull(data) || Objects.isNull((names = (String[]) data.get()))) {
        TimeZoneNamesBundle tznb = localeData.getTimeZoneNames(locale);
        if (tznb.containsKey(key)) {
            names = tznb.getStringArray(key);
            cache.put(cacheKey,
                      new ResourceReference(cacheKey, (Object) names, referenceQueue));
        }
    }

    return names;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:LocaleResources.java

示例4: getZoneIDs

import sun.util.resources.TimeZoneNamesBundle; //导入依赖的package包/类
@SuppressWarnings("unchecked")
Set<String> getZoneIDs() {
    Set<String> zoneIDs = null;

    removeEmptyReferences();
    ResourceReference data = cache.get(ZONE_IDS_CACHEKEY);
    if (data == null || ((zoneIDs = (Set<String>) data.get()) == null)) {
        TimeZoneNamesBundle rb = localeData.getTimeZoneNames(locale);
        zoneIDs = rb.keySet();
        cache.put(ZONE_IDS_CACHEKEY,
                  new ResourceReference(ZONE_IDS_CACHEKEY, (Object) zoneIDs, referenceQueue));
    }

    return zoneIDs;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:LocaleResources.java


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