@Override
protected String getSingleItemDescription(String expression) {
String exp = expression;
if (expression.contains("#")) {
exp = expression.substring(0, expression.indexOf("#"));
} else if (expression.contains("L")) {
exp = exp.replace("L", "");
}
if (StringUtils.isNumeric(exp)) {
int dayOfWeekNum = Integer.parseInt(exp);
boolean isZeroBasedDayOfWeek = (options == null || options.isZeroBasedDayOfWeek());
boolean isInvalidDayOfWeekForSetting = (options != null && !options.isZeroBasedDayOfWeek() && dayOfWeekNum <= 1);
if (isInvalidDayOfWeekForSetting || (isZeroBasedDayOfWeek && dayOfWeekNum == 0)) {
return DateAndTimeUtils.getDayOfWeekName(7);
} else if (options != null && !options.isZeroBasedDayOfWeek()) {
dayOfWeekNum -= 1;
}
return DateAndTimeUtils.getDayOfWeekName(dayOfWeekNum);
} else {
DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("EEE").withLocale(Locale.ENGLISH);
return dateTimeFormatter.parseDateTime(WordUtils.capitalizeFully(exp)).dayOfWeek().getAsText(I18nMessages.getCurrentLocale());
}
}
DayOfWeekDescriptionBuilder.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:sentry
作者:
评论列表
文章目录