package com.ibm.icu4jni.util;
+import java.text.DateFormat;
+
/**
* Passes locale-specific from ICU native code to Java.
* <p>
percentPattern = overrides.percentPattern;
}
}
+
+ public String getDateFormat(int style) {
+ switch (style) {
+ case DateFormat.SHORT:
+ return shortDateFormat;
+ case DateFormat.MEDIUM:
+ return mediumDateFormat;
+ case DateFormat.LONG:
+ return longDateFormat;
+ case DateFormat.FULL:
+ return fullDateFormat;
+ }
+ throw new AssertionError();
+ }
+
+ public String getTimeFormat(int style) {
+ switch (style) {
+ case DateFormat.SHORT:
+ return shortTimeFormat;
+ case DateFormat.MEDIUM:
+ return mediumTimeFormat;
+ case DateFormat.LONG:
+ return longTimeFormat;
+ case DateFormat.FULL:
+ return fullTimeFormat;
+ }
+ throw new AssertionError();
+ }
}
checkDateStyle(style);
// BEGIN android-changed
LocaleData localeData = com.ibm.icu4jni.util.Resources.getLocaleData(locale);
- return new SimpleDateFormat(getDateFormat(localeData, style), locale);
+ return new SimpleDateFormat(localeData.getDateFormat(style), locale);
// END android-changed
}
checkDateStyle(dateStyle);
// BEGIN android-changed
LocaleData localeData = com.ibm.icu4jni.util.Resources.getLocaleData(locale);
- String pattern = getDateFormat(localeData, dateStyle) + " " + getTimeFormat(localeData, timeStyle);
+ String pattern = localeData.getDateFormat(dateStyle) + " " + localeData.getTimeFormat(timeStyle);
return new SimpleDateFormat(pattern, locale);
// END android-changed
}
return numberFormat;
}
- // BEGIN android-added
- protected static String getDateFormat(LocaleData localeData, int style) {
- switch (style) {
- case SHORT:
- return localeData.shortDateFormat;
- case MEDIUM:
- return localeData.mediumDateFormat;
- case LONG:
- return localeData.longDateFormat;
- case FULL:
- return localeData.fullDateFormat;
- }
- throw new AssertionError();
- }
- // END android-added
-
- // BEGIN android-added
- protected static String getTimeFormat(LocaleData localeData, int style) {
- switch (style) {
- case SHORT:
- return localeData.shortTimeFormat;
- case MEDIUM:
- return localeData.mediumTimeFormat;
- case LONG:
- return localeData.longTimeFormat;
- case FULL:
- return localeData.fullTimeFormat;
- }
- throw new AssertionError();
- }
- // END android-added
-
/**
* Returns a {@code DateFormat} instance for formatting and parsing time
* values in the DEFAULT style for the default locale.
checkTimeStyle(style);
// BEGIN android-changed
LocaleData localeData = com.ibm.icu4jni.util.Resources.getLocaleData(locale);
- return new SimpleDateFormat(getTimeFormat(localeData, style), locale);
+ return new SimpleDateFormat(localeData.getTimeFormat(style), locale);
// END android-changed
}