public class CronPattern extends Object
当为6位时,第一位表示秒 ,范围0~59,但是第一位不做匹配 当为7位时,最后一位表示年 ,范围1970~2099,但是第7位不做解析,也不做匹配当定时任务运行到的时间匹配这些表达式后,任务被启动。
当isMatchSecond为 true时才会匹配秒部分
默认都是关闭的
对于每一个子表达式,同样支持以下形式:
间隔(/) > 区间(-) > 列表(,)例如 2,3,6/3中,由于“/”优先级高,因此相当于2,3,(6/3),结果与 2,3,6等价
| 构造器和说明 |
|---|
CronPattern(String pattern)
构造
|
public CronPattern(String pattern)
pattern - 表达式public boolean match(long millis,
boolean isMatchSecond)
millis - 时间毫秒数isMatchSecond - 是否匹配秒true, 否则返回 falsepublic boolean match(TimeZone timezone, long millis, boolean isMatchSecond)
timezone - 时区 TimeZonemillis - 时间毫秒数isMatchSecond - 是否匹配秒true, 否则返回 falsepublic boolean match(GregorianCalendar calendar, boolean isMatchSecond)
calendar - 时间isMatchSecond - 是否匹配秒true, 否则返回 falseCopyright © 2022. All rights reserved.