summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvichang <vichang@google.com>2021-04-21 14:52:13 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-04-21 14:52:13 +0000
commit1b51f6391cc7bc2de889a1d1a23f6b5ca5696f8e (patch)
tree59678054a33d2f0d34daf497f7cf73055e712a0b
parent44f8e62eea78d597e65b700bfc664c540b51a078 (diff)
parent46496f3ee06a2ed07262a24731246798f5d80f48 (diff)
downloadicu-1b51f6391cc7bc2de889a1d1a23f6b5ca5696f8e.tar.gz
Merge "Add options argument to CorePlatformApi DateTimePatternGenerator#getBestPattern"
-rw-r--r--android_icu4j/api/legacy_platform/current.txt2
-rw-r--r--android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java14
-rw-r--r--icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java14
-rw-r--r--tools/srcgen/core-platform-api.txt2
4 files changed, 26 insertions, 6 deletions
diff --git a/android_icu4j/api/legacy_platform/current.txt b/android_icu4j/api/legacy_platform/current.txt
index 31a5337f0..a81a0c650 100644
--- a/android_icu4j/api/legacy_platform/current.txt
+++ b/android_icu4j/api/legacy_platform/current.txt
@@ -14,7 +14,7 @@ package android.icu.text {
}
public class DateTimePatternGenerator implements java.lang.Cloneable android.icu.util.Freezable<android.icu.text.DateTimePatternGenerator> {
- method public String getBestPattern(String, boolean);
+ method public String getBestPattern(String, int, boolean);
}
public final class StringPrep {
diff --git a/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java b/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java
index c2ec9e669..3d667d064 100644
--- a/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java
+++ b/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java
@@ -643,11 +643,21 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
// BEGIN Android-added: http://b/170233598 Allow duplicate fields
/**
+ * Return the best pattern matching the input skeleton. It is guaranteed to
+ * have all of the fields in the skeleton.
+ *
+ * @param skeleton The skeleton is a pattern containing only the variable fields.
+ * For example, "MMMdd" and "mmhh" are skeletons.
+ * @param options MATCH_xxx options for forcing the length of specified fields in
+ * the returned pattern to match those in the skeleton (when this would
+ * not happen otherwise). For default behavior, use MATCH_NO_OPTIONS.
+ * @param allowDuplicateFields allows duplicated field in the skeleton
+ * @return Best pattern matching the input skeleton (and options).
* @hide draft / provisional / internal are hidden on Android
*/
@libcore.api.CorePlatformApi
- public String getBestPattern(String skeleton, boolean allowDuplicateFields) {
- return getBestPattern(skeleton, null, MATCH_NO_OPTIONS, allowDuplicateFields);
+ public String getBestPattern(String skeleton, int options, boolean allowDuplicateFields) {
+ return getBestPattern(skeleton, null, options, allowDuplicateFields);
}
private String getBestPattern(String skeleton, DateTimeMatcher skipMatcher, int options) {
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java b/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
index 8009792ce..919a93482 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
@@ -646,10 +646,20 @@ public class DateTimePatternGenerator implements Freezable<DateTimePatternGenera
// BEGIN Android-added: http://b/170233598 Allow duplicate fields
/**
+ * Return the best pattern matching the input skeleton. It is guaranteed to
+ * have all of the fields in the skeleton.
+ *
+ * @param skeleton The skeleton is a pattern containing only the variable fields.
+ * For example, "MMMdd" and "mmhh" are skeletons.
+ * @param options MATCH_xxx options for forcing the length of specified fields in
+ * the returned pattern to match those in the skeleton (when this would
+ * not happen otherwise). For default behavior, use MATCH_NO_OPTIONS.
+ * @param allowDuplicateFields allows duplicated field in the skeleton
+ * @return Best pattern matching the input skeleton (and options).
* @internal
*/
- public String getBestPattern(String skeleton, boolean allowDuplicateFields) {
- return getBestPattern(skeleton, null, MATCH_NO_OPTIONS, allowDuplicateFields);
+ public String getBestPattern(String skeleton, int options, boolean allowDuplicateFields) {
+ return getBestPattern(skeleton, null, options, allowDuplicateFields);
}
private String getBestPattern(String skeleton, DateTimeMatcher skipMatcher, int options) {
diff --git a/tools/srcgen/core-platform-api.txt b/tools/srcgen/core-platform-api.txt
index af8e9c4c0..0ff685a34 100644
--- a/tools/srcgen/core-platform-api.txt
+++ b/tools/srcgen/core-platform-api.txt
@@ -3,7 +3,7 @@ field:android.icu.text.StringPrep#RFC3920_RESOURCEPREP
enumConstant:android.icu.util.Region$RegionType#TERRITORY
method:android.icu.impl.TimeZoneAdapter#wrap(android.icu.util.TimeZone)
method:android.icu.text.DateFormatSymbols#getAmpmNarrowStrings()
-method:android.icu.text.DateTimePatternGenerator#getBestPattern(String,boolean)
+method:android.icu.text.DateTimePatternGenerator#getBestPattern(String,int,boolean)
method:android.icu.text.StringPrep#getInstance(int)
method:android.icu.text.StringPrep#prepare(String,int)
method:android.icu.util.BasicTimeZone#getNextTransition(long,boolean)