java.util.Calendar.getDisplayNameArray()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(15.4k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中java.util.Calendar.getDisplayNameArray()方法的一些代码示例,展示了Calendar.getDisplayNameArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Calendar.getDisplayNameArray()方法的具体详情如下:
包路径:java.util.Calendar
类名称:Calendar
方法名:getDisplayNameArray

Calendar.getDisplayNameArray介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * 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;
}

代码示例来源:origin: robovm/robovm

/**
 * 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;
}

代码示例来源:origin: ibinti/bugvm

/**
 * 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;
}

代码示例来源:origin: MobiVM/robovm

/**
 * 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;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * 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;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * 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;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * 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;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * 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;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * 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;
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * 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;
}

代码示例来源:origin: MobiVM/robovm

/**
 * 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;
}

代码示例来源:origin: ibinti/bugvm

/**
 * 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;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * 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;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * 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;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * 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;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * 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;
}

相关文章