public enum Part extends Enum<Part>
Enum.ordinal()表示此部分在表达式中的位置,如0表示秒
0 1 2 3 4 5 6
[SECOND] MINUTE HOUR DAY_OF_MONTH MONTH DAY_OF_WEEK [YEAR]
| Enum Constant and Description |
|---|
DAY_OF_MONTH
日[1-31]
|
DAY_OF_WEEK
周中的天,如周一、周日等,[0-6]即[SUNDAY-SATURDAY]
|
HOUR
时[0-23]
|
MINUTE
分[0-59]
|
MONTH
月[1-12]
|
SECOND
秒[0-59]
|
YEAR
年[1970-2099]
|
| Modifier and Type | Method and Description |
|---|---|
int |
checkValue(int value)
检查单个值是否有效
|
int |
getCalendarField()
获取Calendar中对应字段项
|
int |
getMax()
获取最大值
|
int |
getMin()
获取最小值
|
static Part |
of(int i)
根据位置获取Part
|
static Part |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Part[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Part SECOND
public static final Part MINUTE
public static final Part HOUR
public static final Part DAY_OF_MONTH
public static final Part MONTH
public static final Part DAY_OF_WEEK
public static final Part YEAR
public static Part[] values()
for (Part c : Part.values()) System.out.println(c);
public static Part valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic int getCalendarField()
public int getMin()
public int getMax()
public int checkValue(int value)
throws CronException
value - 值CronException - 检查无效抛出此异常public static Part of(int i)
i - 位置,从0开始Copyright © 2025. All rights reserved.