java.util.spi.CalendarNameProvider Java Examples

The following examples show how to use java.util.spi.CalendarNameProvider. 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: CalendarDataUtility.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getObject(CalendarNameProvider calendarNameProvider,
                        Locale locale,
                        String requestID, // calendarType
                        Object... params) {
    assert params.length == 4;
    int field = (int) params[0];
    int value = (int) params[1];
    int style = (int) params[2];
    boolean javatime = (boolean) params[3];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        String name;
        name = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayName(requestID, field, value, style, locale);
        return name;
    }
    return calendarNameProvider.getDisplayName(requestID, field, value, style, locale);
}
 
Example #2
Source File: CalendarDataUtility.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Integer> getObject(CalendarNameProvider calendarNameProvider,
                                      Locale locale,
                                      String requestID, // calendarType
                                      Object... params) {
    assert params.length == 3;
    int field = (int) params[0];
    int style = (int) params[1];
    boolean javatime = (boolean) params[2];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        Map<String, Integer> map;
        map = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayNames(requestID, field, style, locale);
        return map;
    }
    return calendarNameProvider.getDisplayNames(requestID, field, style, locale);
}
 
Example #3
Source File: CalendarDataUtility.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Integer> getObject(CalendarNameProvider calendarNameProvider,
                                      Locale locale,
                                      String requestID, // calendarType
                                      Object... params) {
    assert params.length == 3;
    int field = (int) params[0];
    int style = (int) params[1];
    boolean javatime = (boolean) params[2];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        Map<String, Integer> map;
        map = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayNames(requestID, field, style, locale);
        return map;
    }
    return calendarNameProvider.getDisplayNames(requestID, field, style, locale);
}
 
Example #4
Source File: CalendarDataUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getObject(CalendarNameProvider calendarNameProvider,
                        Locale locale,
                        String requestID, // calendarType
                        Object... params) {
    assert params.length == 4;
    int field = (int) params[0];
    int value = (int) params[1];
    int style = (int) params[2];
    boolean javatime = (boolean) params[3];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        String name;
        name = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayName(requestID, field, value, style, locale);
        return name;
    }
    return calendarNameProvider.getDisplayName(requestID, field, value, style, locale);
}
 
Example #5
Source File: CalendarDataUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Integer> getObject(CalendarNameProvider calendarNameProvider,
                                      Locale locale,
                                      String requestID, // calendarType
                                      Object... params) {
    assert params.length == 3;
    int field = (int) params[0];
    int style = (int) params[1];
    boolean javatime = (boolean) params[2];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        Map<String, Integer> map;
        map = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayNames(requestID, field, style, locale);
        return map;
    }
    return calendarNameProvider.getDisplayNames(requestID, field, style, locale);
}
 
Example #6
Source File: CalendarDataUtility.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Integer> getObject(CalendarNameProvider calendarNameProvider,
                                      Locale locale,
                                      String requestID, // calendarType
                                      Object... params) {
    assert params.length == 3;
    int field = (int) params[0];
    int style = (int) params[1];
    boolean javatime = (boolean) params[2];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        Map<String, Integer> map;
        map = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayNames(requestID, field, style, locale);
        return map;
    }
    return calendarNameProvider.getDisplayNames(requestID, field, style, locale);
}
 
Example #7
Source File: CalendarDataUtility.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Integer> getObject(CalendarNameProvider calendarNameProvider,
                                      Locale locale,
                                      String requestID, // calendarType
                                      Object... params) {
    assert params.length == 3;
    int field = (int) params[0];
    int style = (int) params[1];
    boolean javatime = (boolean) params[2];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        Map<String, Integer> map;
        map = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayNames(requestID, field, style, locale);
        return map;
    }
    return calendarNameProvider.getDisplayNames(requestID, field, style, locale);
}
 
Example #8
Source File: CalendarDataUtility.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getObject(CalendarNameProvider calendarNameProvider,
                        Locale locale,
                        String requestID, // calendarType
                        Object... params) {
    assert params.length == 4;
    int field = (int) params[0];
    int value = (int) params[1];
    int style = (int) params[2];
    boolean javatime = (boolean) params[3];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        String name;
        name = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayName(requestID, field, value, style, locale);
        return name;
    }
    return calendarNameProvider.getDisplayName(requestID, field, value, style, locale);
}
 
Example #9
Source File: CalendarDataUtility.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public String getObject(CalendarNameProvider calendarNameProvider,
                        Locale locale,
                        String requestID, // calendarType
                        Object... params) {
    assert params.length == 4;
    int field = (int) params[0];
    int value = (int) params[1];
    int style = (int) params[2];
    boolean javatime = (boolean) params[3];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        String name;
        name = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayName(requestID, field, value, style, locale);
        return name;
    }
    return calendarNameProvider.getDisplayName(requestID, field, value, style, locale);
}
 
Example #10
Source File: CalendarDataUtility.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getObject(CalendarNameProvider calendarNameProvider,
                        Locale locale,
                        String requestID, // calendarType
                        Object... params) {
    assert params.length == 4;
    int field = (int) params[0];
    int value = (int) params[1];
    int style = (int) params[2];
    boolean javatime = (boolean) params[3];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        String name;
        name = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayName(requestID, field, value, style, locale);
        return name;
    }
    return calendarNameProvider.getDisplayName(requestID, field, value, style, locale);
}
 
Example #11
Source File: CalendarDataUtility.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Integer> getObject(CalendarNameProvider calendarNameProvider,
                                      Locale locale,
                                      String requestID, // calendarType
                                      Object... params) {
    assert params.length == 3;
    int field = (int) params[0];
    int style = (int) params[1];
    boolean javatime = (boolean) params[2];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        Map<String, Integer> map;
        map = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayNames(requestID, field, style, locale);
        return map;
    }
    return calendarNameProvider.getDisplayNames(requestID, field, style, locale);
}
 
Example #12
Source File: CLDRLocaleProviderAdapter.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider = AccessController.doPrivileged(
                (PrivilegedAction<CalendarNameProvider>) ()
                -> new CLDRCalendarNameProviderImpl(
                        getAdapterType(),
                        getLanguageTagSet("FormatData")));

        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}
 
Example #13
Source File: CalendarDataUtility.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getObject(CalendarNameProvider calendarNameProvider,
                        Locale locale,
                        String requestID, // calendarType
                        Object... params) {
    assert params.length == 4;
    int field = (int) params[0];
    int value = (int) params[1];
    int style = (int) params[2];
    boolean javatime = (boolean) params[3];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        String name;
        name = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayName(requestID, field, value, style, locale);
        return name;
    }
    return calendarNameProvider.getDisplayName(requestID, field, value, style, locale);
}
 
Example #14
Source File: JRELocaleProviderAdapter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider = AccessController.doPrivileged(
            (PrivilegedAction<CalendarNameProvider>) () ->
                new CalendarNameProviderImpl(
                    getAdapterType(),
                    getLanguageTagSet("FormatData")));

        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}
 
Example #15
Source File: CalendarDataUtility.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Map<String, Integer> getObject(CalendarNameProvider calendarNameProvider,
                                      Locale locale,
                                      String requestID, // calendarType
                                      Object... params) {
    assert params.length == 3;
    int field = (int) params[0];
    int style = (int) params[1];
    boolean javatime = (boolean) params[2];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        Map<String, Integer> map;
        map = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayNames(requestID, field, style, locale);
        return map;
    }
    return calendarNameProvider.getDisplayNames(requestID, field, style, locale);
}
 
Example #16
Source File: CalendarDataUtility.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getObject(CalendarNameProvider calendarNameProvider,
                        Locale locale,
                        String requestID, // calendarType
                        Object... params) {
    assert params.length == 4;
    int field = (int) params[0];
    int value = (int) params[1];
    int style = (int) params[2];
    boolean javatime = (boolean) params[3];

    // If javatime is true, resources from CLDR have precedence over JRE
    // native resources.
    if (javatime && calendarNameProvider instanceof CalendarNameProviderImpl) {
        String name;
        name = ((CalendarNameProviderImpl)calendarNameProvider)
                .getJavaTimeDisplayName(requestID, field, value, style, locale);
        return name;
    }
    return calendarNameProvider.getDisplayName(requestID, field, value, style, locale);
}
 
Example #17
Source File: CalendarDataUtility.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static String retrieveJavaTimeFieldValueName(String id, int field, int value, int style, Locale locale) {
    LocaleServiceProviderPool pool =
            LocaleServiceProviderPool.getPool(CalendarNameProvider.class);
    String name;
    name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                   field, value, style, true);
    if (name == null) {
        name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                       field, value, style, false);
    }
    return name;
}
 
Example #18
Source File: CalendarDataUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static String retrieveJavaTimeFieldValueName(String id, int field, int value, int style, Locale locale) {
    LocaleServiceProviderPool pool =
            LocaleServiceProviderPool.getPool(CalendarNameProvider.class);
    String name;
    name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                   field, value, style, true);
    if (name == null) {
        name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                       field, value, style, false);
    }
    return name;
}
 
Example #19
Source File: CalendarDataUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static Map<String, Integer> retrieveJavaTimeFieldValueNames(String id, int field, int style, Locale locale) {
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(CalendarNameProvider.class);
    Map<String, Integer> map;
    map = pool.getLocalizedObject(CalendarFieldValueNamesMapGetter.INSTANCE, locale,
                                   normalizeCalendarType(id), field, style, true);
    if (map == null) {
        map = pool.getLocalizedObject(CalendarFieldValueNamesMapGetter.INSTANCE, locale,
                                       normalizeCalendarType(id), field, style, false);
    }
    return map;
}
 
Example #20
Source File: JRELocaleProviderAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider;
        provider = new CalendarNameProviderImpl(getAdapterType(),
                                                getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}
 
Example #21
Source File: SPILocaleProviderAdapter.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, Integer> getDisplayNames(String calendarType,
                                                     int field, int style,
                                                     Locale locale) {
    locale = CalendarDataUtility.findRegionOverride(locale);
    CalendarNameProvider cdp = getImpl(locale);
    return cdp.getDisplayNames(calendarType, field, style, locale);
}
 
Example #22
Source File: CalendarDataUtility.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static String retrieveJavaTimeFieldValueName(String id, int field, int value, int style, Locale locale) {
    LocaleServiceProviderPool pool =
            LocaleServiceProviderPool.getPool(CalendarNameProvider.class);
    String name;
    name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                   field, value, style, true);
    if (name == null) {
        name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                       field, value, style, false);
    }
    return name;
}
 
Example #23
Source File: CalendarDataUtility.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static Map<String, Integer> retrieveJavaTimeFieldValueNames(String id, int field, int style, Locale locale) {
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(CalendarNameProvider.class);
    Map<String, Integer> map;
    map = pool.getLocalizedObject(CalendarFieldValueNamesMapGetter.INSTANCE, locale,
                                   normalizeCalendarType(id), field, style, true);
    if (map == null) {
        map = pool.getLocalizedObject(CalendarFieldValueNamesMapGetter.INSTANCE, locale,
                                       normalizeCalendarType(id), field, style, false);
    }
    return map;
}
 
Example #24
Source File: JRELocaleProviderAdapter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider;
        provider = new CalendarNameProviderImpl(getAdapterType(),
                                                getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}
 
Example #25
Source File: CalendarDataUtility.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static Map<String, Integer> retrieveJavaTimeFieldValueNames(String id, int field, int style, Locale locale) {
    LocaleServiceProviderPool pool =
        LocaleServiceProviderPool.getPool(CalendarNameProvider.class);
    Map<String, Integer> map;
    map = pool.getLocalizedObject(CalendarFieldValueNamesMapGetter.INSTANCE, locale,
                                   normalizeCalendarType(id), field, style, true);
    if (map == null) {
        map = pool.getLocalizedObject(CalendarFieldValueNamesMapGetter.INSTANCE, locale,
                                       normalizeCalendarType(id), field, style, false);
    }
    return map;
}
 
Example #26
Source File: JRELocaleProviderAdapter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider;
        provider = new CalendarNameProviderImpl(getAdapterType(),
                                                getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}
 
Example #27
Source File: JRELocaleProviderAdapter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider;
        provider = new CalendarNameProviderImpl(getAdapterType(),
                                                getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}
 
Example #28
Source File: CalendarDataUtility.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static String retrieveJavaTimeFieldValueName(String id, int field, int value, int style, Locale locale) {
    LocaleServiceProviderPool pool =
            LocaleServiceProviderPool.getPool(CalendarNameProvider.class);
    String name;
    name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                   field, value, style, true);
    if (name == null) {
        name = pool.getLocalizedObject(CalendarFieldValueNameGetter.INSTANCE, locale, normalizeCalendarType(id),
                                       field, value, style, false);
    }
    return name;
}
 
Example #29
Source File: JRELocaleProviderAdapter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider;
        provider = new CalendarNameProviderImpl(getAdapterType(),
                                                getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}
 
Example #30
Source File: JRELocaleProviderAdapter.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public CalendarNameProvider getCalendarNameProvider() {
    if (calendarNameProvider == null) {
        CalendarNameProvider provider;
        provider = new CalendarNameProviderImpl(getAdapterType(),
                                                getLanguageTagSet("FormatData"));
        synchronized (this) {
            if (calendarNameProvider == null) {
                calendarNameProvider = provider;
            }
        }
    }
    return calendarNameProvider;
}