private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }
private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }
private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }
private String[] getDisplayNameArray(int field, int style, Locale locale) { if (field < 0 || field >= FIELD_COUNT) { throw new IllegalArgumentException("bad field " + field); } checkStyle(style); DateFormatSymbols dfs = DateFormatSymbols.getInstance(locale); switch (field) { case AM_PM: return dfs.getAmPmStrings(); case DAY_OF_WEEK: return (style == LONG) ? dfs.getWeekdays() : dfs.getShortWeekdays(); case ERA: return dfs.getEras(); case MONTH: return (style == LONG) ? dfs.getMonths() : dfs.getShortMonths(); } return null; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * <p> * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }
/** * Returns a map of human-readable strings to corresponding values, * for the given field, style, and locale. * Returns null if no strings are available. * * <p>For example, {@code getDisplayNames(MONTH, ALL_STYLES, Locale.US)} would * contain mappings from "Jan" and "January" to {@link #JANUARY}, and so on. * * @param field the field * @param style {@code SHORT}, {@code LONG}, or {@code ALL_STYLES} * @param locale the locale * @return the display name, or null * @throws NullPointerException if {@code locale == null} * @throws IllegalArgumentException if {@code field} or {@code style} is invalid * @since 1.6 */ public Map<String, Integer> getDisplayNames(int field, int style, Locale locale) { checkStyle(style); complete(); Map<String, Integer> result = new HashMap<String, Integer>(); if (style == SHORT || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, SHORT, locale)); } if (style == LONG || style == ALL_STYLES) { insertValuesInMap(result, getDisplayNameArray(field, LONG, locale)); } return result.isEmpty() ? null : result; }