sun.util.resources.OpenListResourceBundle Java Examples

The following examples show how to use sun.util.resources.OpenListResourceBundle. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocaleResources.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #2
Source File: LocaleResources.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #3
Source File: LocaleResources.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #4
Source File: Locale.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a name for the locale's variant code that is appropriate for display to the
 * user.  If possible, the name will be localized for inLocale.  If the locale
 * doesn't specify a variant code, this function returns the empty string.
 *
 * @exception NullPointerException if <code>inLocale</code> is <code>null</code>
 */
public String getDisplayVariant(Locale inLocale) {
    if (baseLocale.getVariant().length() == 0)
        return "";

    OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);

    String names[] = getDisplayVariantArray(bundle, inLocale);

    // Get the localized patterns for formatting a list, and use
    // them to format the list.
    String listPattern = null;
    String listCompositionPattern = null;
    try {
        listPattern = bundle.getString("ListPattern");
        listCompositionPattern = bundle.getString("ListCompositionPattern");
    } catch (MissingResourceException e) {
    }
    return formatList(names, listPattern, listCompositionPattern);
}
 
Example #5
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #6
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #7
Source File: LocaleResources.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #8
Source File: LocaleResources.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #9
Source File: LocaleResources.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #10
Source File: LocaleResources.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #11
Source File: LocaleResources.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #12
Source File: LocaleResources.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #13
Source File: LocaleResources.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #14
Source File: LocaleResources.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #15
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #16
Source File: LocaleResources.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #17
Source File: LocaleResources.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #18
Source File: LocaleResources.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #19
Source File: LocaleResources.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #20
Source File: LocaleResources.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #21
Source File: LocaleResources.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #22
Source File: LocaleResources.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #23
Source File: LocaleResources.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #24
Source File: LocaleResources.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #25
Source File: LocaleResources.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #26
Source File: LocaleResources.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #27
Source File: LocaleResources.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #28
Source File: LocaleResources.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public String getCurrencyName(String key) {
    Object currencyName = null;
    String cacheKey = CURRENCY_NAMES + key;

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

    if (data != null && ((currencyName = data.get()) != null)) {
        if (currencyName.equals(NULLOBJECT)) {
            currencyName = null;
        }

        return (String) currencyName;
    }

    OpenListResourceBundle olrb = localeData.getCurrencyNames(locale);

    if (olrb.containsKey(key)) {
        currencyName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, currencyName, referenceQueue));
    }

    return (String) currencyName;
}
 
Example #29
Source File: LocaleResources.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public String getLocaleName(String key) {
    Object localeName = null;
    String cacheKey = LOCALE_NAMES + key;

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

    if (data != null && ((localeName = data.get()) != null)) {
        if (localeName.equals(NULLOBJECT)) {
            localeName = null;
        }

        return (String) localeName;
    }

    OpenListResourceBundle olrb = localeData.getLocaleNames(locale);

    if (olrb.containsKey(key)) {
        localeName = olrb.getObject(key);
        cache.put(cacheKey,
                  new ResourceReference(cacheKey, localeName, referenceQueue));
    }

    return (String) localeName;
}
 
Example #30
Source File: Locale.java    From jdk-1.7-annotated with Apache License 2.0 5 votes vote down vote up
private String getDisplayString(String code, Locale inLocale, int type) {
    if (code.length() == 0) {
        return "";
    }

    if (inLocale == null) {
        throw new NullPointerException();
    }

    try {
        OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
        String key = (type == DISPLAY_VARIANT ? "%%"+code : code);
        String result = null;

        // Check whether a provider can provide an implementation that's closer
        // to the requested locale than what the Java runtime itself can provide.
        LocaleServiceProviderPool pool =
            LocaleServiceProviderPool.getPool(LocaleNameProvider.class);
        if (pool.hasProviders()) {
            result = pool.getLocalizedObject(
                                LocaleNameGetter.INSTANCE,
                                inLocale, bundle, key,
                                type, code);
        }

        if (result == null) {
            result = bundle.getString(key);
        }

        if (result != null) {
            return result;
        }
    }
    catch (Exception e) {
        // just fall through
    }
    return code;
}