Enum Class Part

java.lang.Object
java.lang.Enum<Part>
org.aoju.bus.cron.pattern.Part
All Implemented Interfaces:
Serializable, Comparable<Part>, Constable

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]
 
Since:
Java 17+
Author:
Kimi Liu
  • Enum Constant Details

    • SECOND

      public static final Part SECOND
    • MINUTE

      public static final Part MINUTE
    • HOUR

      public static final Part HOUR
    • DAY_OF_MONTH

      public static final Part DAY_OF_MONTH
    • MONTH

      public static final Part MONTH
    • DAY_OF_WEEK

      public static final Part DAY_OF_WEEK
    • YEAR

      public static final Part YEAR
  • Method Details

    • values

      public static Part[] 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

      public static Part valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • of

      public static Part of(int i)
      根据位置获取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 - 检查无效抛出此异常