< prev index next >
src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java
Print this page
rev 56794 : [mq]: 8232871
*** 1,7 ****
/*
! * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 31,40 ****
--- 31,41 ----
import java.text.spi.DateFormatSymbolsProvider;
import java.text.spi.DecimalFormatSymbolsProvider;
import java.text.spi.NumberFormatProvider;
import java.util.Collections;
import java.util.Calendar;
+ import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle.Control;
import java.util.Set;
*** 548,566 ****
public boolean isSupportedLocale(Locale locale) {
return isSupportedCalendarLocale(locale);
}
@Override
! public String getDisplayName(String calType, int field, int value,
! int style, Locale locale) {
return null;
}
@Override
! public Map<String, Integer> getDisplayNames(String calType,
int field, int style, Locale locale) {
! return null;
}
};
}
public static CalendarProvider getCalendarProvider() {
--- 549,585 ----
public boolean isSupportedLocale(Locale locale) {
return isSupportedCalendarLocale(locale);
}
@Override
! public String getDisplayName(String calendarType, int field,
! int value, int style, Locale locale) {
! String[] names = getCalendarDisplayStrings(locale.toLanguageTag(),
! field, style);
! if (names != null && value >= 0 && value < names.length) {
! return names[value];
! } else {
return null;
}
+ }
@Override
! public Map<String, Integer> getDisplayNames(String calendarType,
int field, int style, Locale locale) {
! Map<String, Integer> map = null;
! String[] names = getCalendarDisplayStrings(locale.toLanguageTag(),
! field, style);
! if (names != null) {
! map = new HashMap<>();
! for (int value = 0; value < names.length; value++) {
! if (names[value] != null) {
! map.put(names[value], value);
! }
! }
! map = map.isEmpty() ? null : map;
! }
! return map;
}
};
}
public static CalendarProvider getCalendarProvider() {
*** 899,908 ****
--- 918,930 ----
private static native String getExponentSeparator(String langTag, String exponent);
// For CalendarDataProvider
private static native int getCalendarInt(String langTag, int type);
+ // For CalendarNameProvider
+ private static native String[] getCalendarDisplayStrings(String langTag, int field, int style);
+
// For Locale/CurrencyNameProvider
private static native String getDisplayString(String langTag, int key, String value);
// For TimeZoneNameProvider
private static native String getTimeZoneDisplayString(String langTag, int style, String value);
< prev index next >