@Override public Integer getObject(CalendarDataProvider calendarDataProvider, Locale locale, String requestID, // resource key Object... params) { assert params.length == 0; int value; switch (requestID) { case FIRST_DAY_OF_WEEK: value = calendarDataProvider.getFirstDayOfWeek(locale); break; case MINIMAL_DAYS_IN_FIRST_WEEK: value = calendarDataProvider.getMinimalDaysInFirstWeek(locale); break; default: throw new InternalError("invalid requestID: " + requestID); } return (value != 0) ? value : null; }
@Override public CalendarDataProvider getCalendarDataProvider() { if (calendarDataProvider == null) { CalendarDataProvider provider = AccessController.doPrivileged( (PrivilegedAction<CalendarDataProvider>) () -> new CalendarDataProviderImpl( getAdapterType(), getLanguageTagSet("CalendarData"))); synchronized (this) { if (calendarDataProvider == null) { calendarDataProvider = provider; } } } return calendarDataProvider; }
@Override public CalendarDataProvider getCalendarDataProvider() { if (calendarDataProvider == null) { CalendarDataProvider provider; provider = new CalendarDataProviderImpl(getAdapterType(), getLanguageTagSet("CalendarData")); synchronized (this) { if (calendarDataProvider == null) { calendarDataProvider = provider; } } } return calendarDataProvider; }
public static int retrieveFirstDayOfWeek(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CalendarDataProvider.class); Integer value = pool.getLocalizedObject(CalendarWeekParameterGetter.INSTANCE, locale, FIRST_DAY_OF_WEEK); return (value != null && (value >= SUNDAY && value <= SATURDAY)) ? value : SUNDAY; }
public static int retrieveMinimalDaysInFirstWeek(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CalendarDataProvider.class); Integer value = pool.getLocalizedObject(CalendarWeekParameterGetter.INSTANCE, locale, MINIMAL_DAYS_IN_FIRST_WEEK); return (value != null && (value >= 1 && value <= 7)) ? value : 1; }
public static int retrieveFirstDayOfWeek(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CalendarDataProvider.class); Integer value = pool.getLocalizedObject(CalendarWeekParameterGetter.INSTANCE, locale, true, FIRST_DAY_OF_WEEK); return (value != null && (value >= SUNDAY && value <= SATURDAY)) ? value : SUNDAY; }
public static int retrieveMinimalDaysInFirstWeek(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CalendarDataProvider.class); Integer value = pool.getLocalizedObject(CalendarWeekParameterGetter.INSTANCE, locale, true, MINIMAL_DAYS_IN_FIRST_WEEK); return (value != null && (value >= 1 && value <= 7)) ? value : 1; }
@Override public CalendarDataProvider getCalendarDataProvider() { return getLocaleServiceProvider(CalendarDataProvider.class); }
@Override public void addImpl(CalendarDataProvider impl) { for (Locale l : impl.getAvailableLocales()) { map.putIfAbsent(l, impl); } }
@Override public CalendarDataProvider getImpl(Locale locale) { return SPILocaleProviderAdapter.getImpl(map, locale); }