use of java.text.spi.DateFormatSymbolsProvider in project jdk8u_jdk by JetBrains.
the class DateFormatSymbols method getProviderInstance.
private static DateFormatSymbols getProviderInstance(Locale locale) {
LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DateFormatSymbolsProvider.class, locale);
DateFormatSymbolsProvider provider = adapter.getDateFormatSymbolsProvider();
DateFormatSymbols dfsyms = provider.getInstance(locale);
if (dfsyms == null) {
provider = LocaleProviderAdapter.forJRE().getDateFormatSymbolsProvider();
dfsyms = provider.getInstance(locale);
}
return dfsyms;
}
use of java.text.spi.DateFormatSymbolsProvider in project jdk8u_jdk by JetBrains.
the class HostLocaleProviderAdapterImpl method getDateFormatSymbolsProvider.
public static DateFormatSymbolsProvider getDateFormatSymbolsProvider() {
return new DateFormatSymbolsProvider() {
@Override
public Locale[] getAvailableLocales() {
return getSupportedCalendarLocales();
}
@Override
public boolean isSupportedLocale(Locale locale) {
return isSupportedCalendarLocale(locale);
}
@Override
public DateFormatSymbols getInstance(Locale locale) {
DateFormatSymbols dfs;
SoftReference<DateFormatSymbols> ref = dateFormatSymbolsCache.get(locale);
if (ref == null || (dfs = ref.get()) == null) {
dfs = new DateFormatSymbols(locale);
String langTag = removeExtensions(locale).toLanguageTag();
dfs.setAmPmStrings(getAmPmStrings(langTag, dfs.getAmPmStrings()));
dfs.setEras(getEras(langTag, dfs.getEras()));
dfs.setMonths(getMonths(langTag, dfs.getMonths()));
dfs.setShortMonths(getShortMonths(langTag, dfs.getShortMonths()));
dfs.setWeekdays(getWeekdays(langTag, dfs.getWeekdays()));
dfs.setShortWeekdays(getShortWeekdays(langTag, dfs.getShortWeekdays()));
ref = new SoftReference<>(dfs);
dateFormatSymbolsCache.put(locale, ref);
}
return (DateFormatSymbols) dfs.clone();
}
};
}
Aggregations