public class Cron extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected static Integer |
ALL_SPEC |
protected static int |
ALL_SPEC_INT |
protected static int |
DAY_OF_MONTH |
protected static int |
DAY_OF_WEEK |
protected TreeSet<Integer> |
daysOfMonth |
protected TreeSet<Integer> |
daysOfWeek |
protected boolean |
expressionParsed |
protected static int |
HOUR |
protected TreeSet<Integer> |
hours |
protected int |
lastDayOffset |
protected boolean |
lastDayOfMonth |
protected boolean |
lastDayOfWeek |
static int |
MAX_YEAR |
protected static int |
MINUTE |
protected TreeSet<Integer> |
minutes |
protected static int |
MONTH |
protected static Map<String,Integer> |
MONTH_MAP |
protected TreeSet<Integer> |
months |
protected boolean |
nearestWeekday |
protected static Integer |
NO_SPEC |
protected static int |
NO_SPEC_INT |
protected int |
nthDayOfWeek |
protected static int |
SECOND |
protected TreeSet<Integer> |
seconds |
protected static Map<String,Integer> |
WEEK_DAY_MAP |
protected static int |
YEAR |
protected TreeSet<Integer> |
years |
Modifier and Type | Method and Description |
---|---|
protected void |
addToSet(int val,
int end,
int incr,
int type) |
protected void |
buildExpression(String expression)
构建表达式
|
protected int |
checkNext(int pos,
String s,
int val,
int type) |
protected int |
findNextWhiteSpace(int i,
String s) |
String |
getCronExpression() |
protected int |
getDayOfWeekNumber(String s) |
protected String |
getExpressionSetSummary(List<Integer> list) |
protected String |
getExpressionSetSummary(Set<Integer> set) |
String |
getExpressionSummary()
获取表达式摘要
|
protected int |
getLastDayOfMonth(int monthNum,
int year) |
protected int |
getMonthNumber(String s) |
Date |
getNextInvalidTimeAfter(Date date)
返回满足 cron 表达式的给定时间的下一个时间
如果未来不会执行 则返回下一秒 不可能为null(不准确)
|
Date |
getNextValidTimeAfter(Date date)
返回满足 cron 表达式的给定时间的下一个时间
如果未来不会执行 则返回null(准确)
|
protected int |
getNumericValue(String s,
int i) |
Date |
getTimeAfter(Date afterTime) |
TimeZone |
getTimeZone() |
protected cn.orionsec.kit.lang.utils.time.cron.Cron.ValueSet |
getValue(int v,
String s,
int i) |
boolean |
isSatisfiedBy(Date date)
表示给定的日期是否满足 cron 表达式 毫秒被忽略
|
static Cron |
of(String cronExpression) |
protected void |
setCalendarHour(Calendar cal,
int hour)
设置日历hour
|
void |
setTimeZone(TimeZone timeZone) |
protected int |
skipWhiteSpace(int i,
String s) |
protected int |
storeExpressionVal(int pos,
String s,
int type) |
String |
toString() |
protected static final int SECOND
protected static final int MINUTE
protected static final int HOUR
protected static final int DAY_OF_MONTH
protected static final int MONTH
protected static final int DAY_OF_WEEK
protected static final int YEAR
protected static final int ALL_SPEC_INT
protected static final int NO_SPEC_INT
protected static final Integer ALL_SPEC
protected static final Integer NO_SPEC
protected transient boolean lastDayOfWeek
protected transient int nthDayOfWeek
protected transient boolean lastDayOfMonth
protected transient boolean nearestWeekday
protected transient int lastDayOffset
protected transient boolean expressionParsed
public static final int MAX_YEAR
public Cron(String cronExpression)
public boolean isSatisfiedBy(Date date)
date
- datepublic Date getNextValidTimeAfter(Date date)
date
- 开始时间public Date getNextInvalidTimeAfter(Date date)
date
- 开始时间public TimeZone getTimeZone()
public void setTimeZone(TimeZone timeZone)
public String getCronExpression()
public String getExpressionSummary()
protected void buildExpression(String expression)
expression
- expressionprotected int storeExpressionVal(int pos, String s, int type)
protected int checkNext(int pos, String s, int val, int type)
protected int skipWhiteSpace(int i, String s)
protected int findNextWhiteSpace(int i, String s)
protected void addToSet(int val, int end, int incr, int type)
protected cn.orionsec.kit.lang.utils.time.cron.Cron.ValueSet getValue(int v, String s, int i)
protected int getNumericValue(String s, int i)
protected int getMonthNumber(String s)
protected int getDayOfWeekNumber(String s)
protected void setCalendarHour(Calendar cal, int hour)
cal
- calendarhour
- hourprotected int getLastDayOfMonth(int monthNum, int year)
Copyright © 2024. All rights reserved.