@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); }
@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); }
@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; }
@Override public CalendarNameProvider getCalendarNameProvider() { if (calendarNameProvider == null) { CalendarNameProvider provider; provider = new CalendarNameProviderImpl(getAdapterType(), getLanguageTagSet("FormatData")); synchronized (this) { if (calendarNameProvider == null) { calendarNameProvider = provider; } } } return calendarNameProvider; }
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; }
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; }