8318569: Add getter methods for Locale and Patterns in ListFormat

Reviewed-by: joehw, rriggs, iris, mli
This commit is contained in:
Naoto Sato 2023-10-24 16:54:57 +00:00
parent 6f352740cb
commit 116503754c
2 changed files with 60 additions and 1 deletions

View file

@ -322,6 +322,26 @@ public final class ListFormat extends Format {
return new ListFormat(Locale.ROOT, Arrays.copyOf(patterns, PATTERN_ARRAY_LENGTH));
}
/**
* {@return the {@code Locale} of this ListFormat}
*
* The {@code locale} is defined by {@link #getInstance(Locale, Type, Style)} or
* {@link #getInstance(String[])}.
*/
public Locale getLocale() {
return locale;
}
/**
* {@return the patterns used in this ListFormat}
*
* The {@code patterns} are defined by {@link #getInstance(Locale, Type, Style)} or
* {@link #getInstance(String[])}.
*/
public String[] getPatterns() {
return Arrays.copyOf(patterns, patterns.length);
}
/**
* {@return the string that consists of the input strings, concatenated with the
* patterns of this {@code ListFormat}}