/** * Returns a human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : 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 human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : null; }
/** * Returns a human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : null; }
/** * Returns a human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : null; }
/** * Returns a human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * <p> * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : null; }
/** * Returns a human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : null; }
/** * Returns a human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : null; }
/** * Returns a human-readable string for the value of {@code field} * using the given style and locale. If no string is available, returns null. * The value is retrieved by invoking {@code get(field)}. * * <p>For example, {@code getDisplayName(MONTH, SHORT, Locale.US)} will return "Jan" * while {@code getDisplayName(MONTH, LONG, Locale.US)} will return "January". * * @param field the field * @param style {@code SHORT} or {@code LONG} * @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 String getDisplayName(int field, int style, Locale locale) { // TODO: the RI's documentation says ALL_STYLES is invalid, but actually treats it as SHORT. if (style == ALL_STYLES) { style = SHORT; } String[] array = getDisplayNameArray(field, style, locale); int value = get(field); return (array != null) ? array[value] : 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> * <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; }
/** * 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>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; }