本文整理了Java中java.util.Calendar.checkStyle()
方法的一些代码示例,展示了Calendar.checkStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Calendar.checkStyle()
方法的具体详情如下:
包路径:java.util.Calendar
类名称:Calendar
方法名:checkStyle
暂无
代码示例来源:origin: robovm/robovm
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;
}
代码示例来源: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: com.mobidevelop.robovm/robovm-rt
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;
}
代码示例来源:origin: MobiVM/robovm
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;
}
代码示例来源:origin: ibinti/bugvm
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;
}
代码示例来源:origin: com.bugvm/bugvm-rt
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;
}
代码示例来源: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.jtransc/jtransc-rt
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;
}
代码示例来源:origin: com.gluonhq/robovm-rt
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;
}
代码示例来源: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: FlexoVM/flexovm
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;
}
代码示例来源: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.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: 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: 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: 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;
}
内容来源于网络,如有侵权,请联系作者删除!