Package org.aoju.bus.cron.pattern
Enum Class Part
- All Implemented Interfaces:
Serializable,Comparable<Part>,Constable
表达式各个部分的枚举,用于限定在表达式中的位置和规则(如最小值和最大值)
表达式各个部分的枚举位置为:
Enum.ordinal()表示此部分在表达式中的位置,如0表示秒表达式各个部分的枚举位置为:
0 1 2 3 4 5 6
[SECOND] MINUTE HOUR DAY_OF_MONTH MONTH DAY_OF_WEEK [YEAR]
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionintcheckValue(int value) 检查单个值是否有效int获取Calendar中对应字段项intgetMax()获取最大值intgetMin()获取最小值static Partof(int i) 根据位置获取Partstatic PartReturns the enum constant of this class with the specified name.static Part[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SECOND
-
MINUTE
-
HOUR
-
DAY_OF_MONTH
-
MONTH
-
DAY_OF_WEEK
-
YEAR
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
of
根据位置获取Part- Parameters:
i- 位置,从0开始- Returns:
- Part
-
getCalendarField
public int getCalendarField()获取Calendar中对应字段项- Returns:
- Calendar中对应字段项
-
getMin
public int getMin()获取最小值- Returns:
- 最小值
-
getMax
public int getMax()获取最大值- Returns:
- 最大值
-
checkValue
public int checkValue(int value) throws org.aoju.bus.core.exception.CrontabException 检查单个值是否有效- Parameters:
value- 值- Returns:
- 检查后的值
- Throws:
org.aoju.bus.core.exception.CrontabException- 检查无效抛出此异常
-