Java 类java.util.spi.TimeZoneNameProvider 实例源码

项目:OpenJSharp    文件:TimeZoneNameUtility.java   
private static String[][] loadZoneStrings(Locale locale) {
    // If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings
    // in order to avoid per-ID retrieval.
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
    TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
    if (provider instanceof TimeZoneNameProviderImpl) {
        return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
    }

    // Performs per-ID retrieval.
    Set<String> zoneIDs = LocaleProviderAdapter.forJRE().getLocaleResources(locale).getZoneIDs();
    List<String[]> zones = new LinkedList<>();
    for (String key : zoneIDs) {
        String[] names = retrieveDisplayNamesImpl(key, locale);
        if (names != null) {
            zones.add(names);
        }
    }

    String[][] zonesArray = new String[zones.size()][];
    return zones.toArray(zonesArray);
}
项目:OpenJSharp    文件:TimeZoneNameUtility.java   
private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                       String id,
                                       Map<String, String> aliases) {
    if (aliases.containsValue(id)) {
        for (Map.Entry<String, String> entry : aliases.entrySet()) {
            if (entry.getValue().equals(id)) {
                String alias = entry.getKey();
                String[] names = buildZoneStrings(tznp, locale, alias);
                if (names != null) {
                    return names;
                }
                names = examineAliases(tznp, locale, alias, aliases);
                if (names != null) {
                    return names;
                }
            }
        }
    }

    return null;
}
项目:OpenJSharp    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:OpenJSharp    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    if (aliases.containsValue(tzid)) {
        for (Map.Entry<String, String> entry : aliases.entrySet()) {
            if (entry.getValue().equals(tzid)) {
                String alias = entry.getKey();
                String name = getName(tznp, locale, requestID, style, alias);
                if (name != null) {
                    return name;
                }
                name = examineAliases(tznp, locale, requestID, alias, style, aliases);
                if (name != null) {
                    return name;
                }
            }
        }
    }
    return null;
}
项目:OpenJSharp    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:jdk8u-jdk    文件:TimeZoneNameUtility.java   
private static String[][] loadZoneStrings(Locale locale) {
    // If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings
    // in order to avoid per-ID retrieval.
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
    TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
    if (provider instanceof TimeZoneNameProviderImpl) {
        return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
    }

    // Performs per-ID retrieval.
    Set<String> zoneIDs = LocaleProviderAdapter.forJRE().getLocaleResources(locale).getZoneIDs();
    List<String[]> zones = new LinkedList<>();
    for (String key : zoneIDs) {
        String[] names = retrieveDisplayNamesImpl(key, locale);
        if (names != null) {
            zones.add(names);
        }
    }

    String[][] zonesArray = new String[zones.size()][];
    return zones.toArray(zonesArray);
}
项目:jdk8u-jdk    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:jdk8u-jdk    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    for (Map.Entry<String, String> entry : aliases.entrySet()) {
        if (entry.getValue().equals(tzid)) {
            String alias = entry.getKey();
            String name = getName(tznp, locale, requestID, style, alias);
            if (name != null) {
                return name;
            }
            name = examineAliases(tznp, locale, requestID, alias, style, aliases);
            if (name != null) {
                return name;
            }
        }
    }
    return null;
}
项目:jdk8u-jdk    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:openjdk-jdk10    文件:JRELocaleProviderAdapter.java   
@Override
public TimeZoneNameProvider getTimeZoneNameProvider() {
    if (timeZoneNameProvider == null) {
        TimeZoneNameProvider provider = AccessController.doPrivileged(
            (PrivilegedAction<TimeZoneNameProvider>) () ->
                new TimeZoneNameProviderImpl(
                    getAdapterType(),
                    getLanguageTagSet("TimeZoneNames")));

        synchronized (this) {
            if (timeZoneNameProvider == null) {
                timeZoneNameProvider = provider;
            }
        }
    }
    return timeZoneNameProvider;
}
项目:openjdk-jdk10    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:openjdk-jdk10    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    for (Map.Entry<String, String> entry : aliases.entrySet()) {
        if (entry.getValue().equals(tzid)) {
            String alias = entry.getKey();
            String name = getName(tznp, locale, requestID, style, alias);
            if (name != null) {
                return name;
            }
            name = examineAliases(tznp, locale, requestID, alias, style, aliases);
            if (name != null) {
                return name;
            }
        }
    }
    return null;
}
项目:openjdk-jdk10    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:openjdk9    文件:JRELocaleProviderAdapter.java   
@Override
public TimeZoneNameProvider getTimeZoneNameProvider() {
    if (timeZoneNameProvider == null) {
        TimeZoneNameProvider provider = AccessController.doPrivileged(
            (PrivilegedAction<TimeZoneNameProvider>) () ->
                new TimeZoneNameProviderImpl(
                    getAdapterType(),
                    getLanguageTagSet("TimeZoneNames")));

        synchronized (this) {
            if (timeZoneNameProvider == null) {
                timeZoneNameProvider = provider;
            }
        }
    }
    return timeZoneNameProvider;
}
项目:openjdk9    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:openjdk9    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    for (Map.Entry<String, String> entry : aliases.entrySet()) {
        if (entry.getValue().equals(tzid)) {
            String alias = entry.getKey();
            String name = getName(tznp, locale, requestID, style, alias);
            if (name != null) {
                return name;
            }
            name = examineAliases(tznp, locale, requestID, alias, style, aliases);
            if (name != null) {
                return name;
            }
        }
    }
    return null;
}
项目:openjdk9    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:jdk8u_jdk    文件:TimeZoneNameUtility.java   
private static String[][] loadZoneStrings(Locale locale) {
    // If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings
    // in order to avoid per-ID retrieval.
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
    TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
    if (provider instanceof TimeZoneNameProviderImpl) {
        return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
    }

    // Performs per-ID retrieval.
    Set<String> zoneIDs = LocaleProviderAdapter.forJRE().getLocaleResources(locale).getZoneIDs();
    List<String[]> zones = new LinkedList<>();
    for (String key : zoneIDs) {
        String[] names = retrieveDisplayNamesImpl(key, locale);
        if (names != null) {
            zones.add(names);
        }
    }

    String[][] zonesArray = new String[zones.size()][];
    return zones.toArray(zonesArray);
}
项目:jdk8u_jdk    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:jdk8u_jdk    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    for (Map.Entry<String, String> entry : aliases.entrySet()) {
        if (entry.getValue().equals(tzid)) {
            String alias = entry.getKey();
            String name = getName(tznp, locale, requestID, style, alias);
            if (name != null) {
                return name;
            }
            name = examineAliases(tznp, locale, requestID, alias, style, aliases);
            if (name != null) {
                return name;
            }
        }
    }
    return null;
}
项目:jdk8u_jdk    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:lookaside_java-1.8.0-openjdk    文件:TimeZoneNameUtility.java   
private static String[][] loadZoneStrings(Locale locale) {
    // If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings
    // in order to avoid per-ID retrieval.
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
    TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
    if (provider instanceof TimeZoneNameProviderImpl) {
        return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
    }

    // Performs per-ID retrieval.
    Set<String> zoneIDs = LocaleProviderAdapter.forJRE().getLocaleResources(locale).getZoneIDs();
    List<String[]> zones = new LinkedList<>();
    for (String key : zoneIDs) {
        String[] names = retrieveDisplayNamesImpl(key, locale);
        if (names != null) {
            zones.add(names);
        }
    }

    String[][] zonesArray = new String[zones.size()][];
    return zones.toArray(zonesArray);
}
项目:lookaside_java-1.8.0-openjdk    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:lookaside_java-1.8.0-openjdk    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    for (Map.Entry<String, String> entry : aliases.entrySet()) {
        if (entry.getValue().equals(tzid)) {
            String alias = entry.getKey();
            String name = getName(tznp, locale, requestID, style, alias);
            if (name != null) {
                return name;
            }
            name = examineAliases(tznp, locale, requestID, alias, style, aliases);
            if (name != null) {
                return name;
            }
        }
    }
    return null;
}
项目:lookaside_java-1.8.0-openjdk    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:infobip-open-jdk-8    文件:TimeZoneNameUtility.java   
private static String[][] loadZoneStrings(Locale locale) {
    // If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings
    // in order to avoid per-ID retrieval.
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
    TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
    if (provider instanceof TimeZoneNameProviderImpl) {
        return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
    }

    // Performs per-ID retrieval.
    Set<String> zoneIDs = LocaleProviderAdapter.forJRE().getLocaleResources(locale).getZoneIDs();
    List<String[]> zones = new LinkedList<>();
    for (String key : zoneIDs) {
        String[] names = retrieveDisplayNamesImpl(key, locale);
        if (names != null) {
            zones.add(names);
        }
    }

    String[][] zonesArray = new String[zones.size()][];
    return zones.toArray(zonesArray);
}
项目:infobip-open-jdk-8    文件:TimeZoneNameUtility.java   
private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                       String id,
                                       Map<String, String> aliases) {
    if (aliases.containsValue(id)) {
        for (Map.Entry<String, String> entry : aliases.entrySet()) {
            if (entry.getValue().equals(id)) {
                String alias = entry.getKey();
                String[] names = buildZoneStrings(tznp, locale, alias);
                if (names != null) {
                    return names;
                }
                names = examineAliases(tznp, locale, alias, aliases);
                if (names != null) {
                    return names;
                }
            }
        }
    }

    return null;
}
项目:infobip-open-jdk-8    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:infobip-open-jdk-8    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    if (aliases.containsValue(tzid)) {
        for (Map.Entry<String, String> entry : aliases.entrySet()) {
            if (entry.getValue().equals(tzid)) {
                String alias = entry.getKey();
                String name = getName(tznp, locale, requestID, style, alias);
                if (name != null) {
                    return name;
                }
                name = examineAliases(tznp, locale, requestID, alias, style, aliases);
                if (name != null) {
                    return name;
                }
            }
        }
    }
    return null;
}
项目:infobip-open-jdk-8    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:jdk8u-dev-jdk    文件:TimeZoneNameUtility.java   
private static String[][] loadZoneStrings(Locale locale) {
    // If the provider is a TimeZoneNameProviderImpl, call its getZoneStrings
    // in order to avoid per-ID retrieval.
    LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(TimeZoneNameProvider.class, locale);
    TimeZoneNameProvider provider = adapter.getTimeZoneNameProvider();
    if (provider instanceof TimeZoneNameProviderImpl) {
        return ((TimeZoneNameProviderImpl)provider).getZoneStrings(locale);
    }

    // Performs per-ID retrieval.
    Set<String> zoneIDs = LocaleProviderAdapter.forJRE().getLocaleResources(locale).getZoneIDs();
    List<String[]> zones = new LinkedList<>();
    for (String key : zoneIDs) {
        String[] names = retrieveDisplayNamesImpl(key, locale);
        if (names != null) {
            zones.add(names);
        }
    }

    String[][] zonesArray = new String[zones.size()][];
    return zones.toArray(zonesArray);
}
项目:jdk8u-dev-jdk    文件:TimeZoneNameUtility.java   
private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                       String id,
                                       Map<String, String> aliases) {
    if (aliases.containsValue(id)) {
        for (Map.Entry<String, String> entry : aliases.entrySet()) {
            if (entry.getValue().equals(id)) {
                String alias = entry.getKey();
                String[] names = buildZoneStrings(tznp, locale, alias);
                if (names != null) {
                    return names;
                }
                names = examineAliases(tznp, locale, alias, aliases);
                if (names != null) {
                    return names;
                }
            }
        }
    }

    return null;
}
项目:jdk8u-dev-jdk    文件:TimeZoneNameUtility.java   
@Override
public String getObject(TimeZoneNameProvider timeZoneNameProvider,
                        Locale locale,
                        String requestID,
                        Object... params) {
    assert params.length == 2;
    int style = (int) params[0];
    String tzid = (String) params[1];
    String value = getName(timeZoneNameProvider, locale, requestID, style, tzid);
    if (value == null) {
        Map<String, String> aliases = ZoneInfo.getAliasTable();
        if (aliases != null) {
            String canonicalID = aliases.get(tzid);
            if (canonicalID != null) {
                value = getName(timeZoneNameProvider, locale, requestID, style, canonicalID);
            }
            if (value == null) {
                value = examineAliases(timeZoneNameProvider, locale, requestID,
                             canonicalID != null ? canonicalID : tzid, style, aliases);
            }
        }
    }

    return value;
}
项目:jdk8u-dev-jdk    文件:TimeZoneNameUtility.java   
private static String examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                     String requestID, String tzid, int style,
                                     Map<String, String> aliases) {
    if (aliases.containsValue(tzid)) {
        for (Map.Entry<String, String> entry : aliases.entrySet()) {
            if (entry.getValue().equals(tzid)) {
                String alias = entry.getKey();
                String name = getName(tznp, locale, requestID, style, alias);
                if (name != null) {
                    return name;
                }
                name = examineAliases(tznp, locale, requestID, alias, style, aliases);
                if (name != null) {
                    return name;
                }
            }
        }
    }
    return null;
}
项目:jdk8u-dev-jdk    文件:TimeZoneNameUtility.java   
private static String getName(TimeZoneNameProvider timeZoneNameProvider,
                              Locale locale, String requestID, int style, String tzid) {
    String value = null;
    switch (requestID) {
    case "std":
        value = timeZoneNameProvider.getDisplayName(tzid, false, style, locale);
        break;
    case "dst":
        value = timeZoneNameProvider.getDisplayName(tzid, true, style, locale);
        break;
    case "generic":
        value = timeZoneNameProvider.getGenericDisplayName(tzid, style, locale);
        break;
    }
    return value;
}
项目:jdk7-jdk    文件:TimeZoneNameUtility.java   
private static final String[] retrieveDisplayNames(OpenListResourceBundle rb,
                                            String id, Locale locale) {
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
    String[] names = null;

    // Check whether a provider can provide an implementation that's closer
    // to the requested locale than what the Java runtime itself can provide.
    if (pool.hasProviders()) {
        names = pool.getLocalizedObject(
                        TimeZoneNameGetter.INSTANCE,
                        locale, rb, id);
    }

    if (names == null) {
        try {
            names = rb.getStringArray(id);
        } catch (MissingResourceException mre) {
            // fall through
        }
    }

    return names;
}
项目:jdk7-jdk    文件:TimeZoneNameUtility.java   
private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                       String id,
                                       Map<String, String> aliases,
                                       Set<Map.Entry<String, String>> aliasesSet) {
    if (aliases.containsValue(id)) {
        for (Map.Entry<String, String> entry : aliasesSet) {
            if (entry.getValue().equals(id)) {
                String alias = entry.getKey();
                String[] names = buildZoneStrings(tznp, locale, alias);
                if (names != null) {
                    return names;
                } else {
                    names = examineAliases(tznp, locale, alias, aliases, aliasesSet);
                    if (names != null) {
                        return names;
                    }
                }
            }
        }
    }

    return null;
}
项目:jdk7-jdk    文件:TimeZoneNameUtility.java   
private static String[] buildZoneStrings(TimeZoneNameProvider tznp,
                            Locale locale, String id) {
    String[] names = new String[5];

    for (int i = 1; i <= 4; i ++) {
        names[i] = tznp.getDisplayName(id, i>=3, i%2, locale);
        if (i >= 3 && names[i] == null) {
            names[i] = names[i-2];
        }
    }

    if (names[1] == null) {
        // this id seems not localized by this provider
        names = null;
    }

    return names;
}
项目:openjdk-source-code-learn    文件:TimeZoneNameUtility.java   
private static final String[] retrieveDisplayNames(OpenListResourceBundle rb,
                                            String id, Locale locale) {
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(TimeZoneNameProvider.class);
    String[] names = null;

    // Check whether a provider can provide an implementation that's closer
    // to the requested locale than what the Java runtime itself can provide.
    if (pool.hasProviders()) {
        names = pool.getLocalizedObject(
                        TimeZoneNameGetter.INSTANCE,
                        locale, rb, id);
    }

    if (names == null) {
        try {
            names = rb.getStringArray(id);
        } catch (MissingResourceException mre) {
            // fall through
        }
    }

    return names;
}
项目:openjdk-source-code-learn    文件:TimeZoneNameUtility.java   
private static String[] examineAliases(TimeZoneNameProvider tznp, Locale locale,
                                       String id,
                                       Map<String, String> aliases,
                                       Set<Map.Entry<String, String>> aliasesSet) {
    if (aliases.containsValue(id)) {
        for (Map.Entry<String, String> entry : aliasesSet) {
            if (entry.getValue().equals(id)) {
                String alias = entry.getKey();
                String[] names = buildZoneStrings(tznp, locale, alias);
                if (names != null) {
                    return names;
                } else {
                    names = examineAliases(tznp, locale, alias, aliases, aliasesSet);
                    if (names != null) {
                        return names;
                    }
                }
            }
        }
    }

    return null;
}