ICU-7467 Added @internal NumberFormat#getPatternForStyle and reverted API signature of NumberFormat#getPattern, so we don't need to change API signature of existing @stable API.

X-SVN-Rev: 39944
This commit is contained in:
Yoshito Umaoka 2017-03-27 19:13:58 +00:00
parent cdcb7944b8
commit c0007833e1
3 changed files with 14 additions and 4 deletions

View file

@ -852,7 +852,7 @@ public class Parse {
private CurrencyAffixPatterns(ULocale uloc) {
// Get the basic currency pattern.
String pattern = NumberFormat.getPattern(uloc, NumberFormat.CURRENCYSTYLE);
String pattern = NumberFormat.getPatternForStyle(uloc, NumberFormat.CURRENCYSTYLE);
addPattern(pattern);
// Get the currency plural patterns.

View file

@ -163,9 +163,9 @@ public class CompactDecimalFormat extends Format.BeforeFormat {
ULocale uloc = symbols.getULocale();
String pattern;
if (fingerprint.compactType == CompactType.CURRENCY) {
pattern = NumberFormat.getPattern(uloc, NumberFormat.CURRENCYSTYLE);
pattern = NumberFormat.getPatternForStyle(uloc, NumberFormat.CURRENCYSTYLE);
} else {
pattern = NumberFormat.getPattern(uloc, NumberFormat.NUMBERSTYLE);
pattern = NumberFormat.getPatternForStyle(uloc, NumberFormat.NUMBERSTYLE);
}
// TODO: Clean this up; avoid the extra object creations.
// TODO: Currency may also need to override grouping settings, not just affixes.

View file

@ -1462,11 +1462,21 @@ public abstract class NumberFormat extends UFormat {
* @param choice the pattern format.
* @return the pattern
* @stable ICU 3.2
*/
protected static String getPattern(ULocale forLocale, int choice) {
return getPatternForStyle(forLocale, choice);
}
/**
* Returns the pattern for the provided locale and choice.
* @param forLocale the locale of the data.
* @param choice the pattern format.
* @return the pattern
* @internal
* @deprecated This API is ICU internal only.
*/
@Deprecated
public static String getPattern(ULocale forLocale, int choice) {
public static String getPatternForStyle(ULocale forLocale, int choice) {
/* for ISOCURRENCYSTYLE and PLURALCURRENCYSTYLE,
* the pattern is the same as the pattern of CURRENCYSTYLE
* but by replacing the single currency sign with