Enum Class YearHalf.Half

java.lang.Object
java.lang.Enum<YearHalf.Half>
cloud.opencode.base.date.extra.YearHalf.Half
All Implemented Interfaces:
Serializable, Comparable<YearHalf.Half>, Constable
Enclosing class:
YearHalf

public static enum YearHalf.Half extends Enum<YearHalf.Half>
Enum representing the two halves of a year 表示一年两半的枚举
Since:
JDK 25, opencode-base-date V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Enum Constant Details

    • H1

      public static final YearHalf.Half H1
      First half (January - June) 上半年(1月-6月)
    • H2

      public static final YearHalf.Half H2
      Second half (July - December) 下半年(7月-12月)
  • Method Details

    • values

      public static YearHalf.Half[] 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 YearHalf.Half 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
    • getValue

      public int getValue()
      Gets the half value (1 or 2) 获取半年值(1或2)
      Returns:
      the value | 值
    • firstMonth

      public Month firstMonth()
      Gets the first month of this half 获取此半年的第一个月
      Returns:
      the first month | 第一个月
    • lastMonth

      public Month lastMonth()
      Gets the last month of this half 获取此半年的最后一个月
      Returns:
      the last month | 最后一个月
    • of

      public static YearHalf.Half of(int value)
      Gets a Half from value 从值获取Half
      Parameters:
      value - the value (1 or 2) | 值(1或2)
      Returns:
      the Half | Half
    • ofMonth

      public static YearHalf.Half ofMonth(Month month)
      Gets the Half containing the specified month 获取包含指定月份的Half
      Parameters:
      month - the month | 月份
      Returns:
      the Half | Half
    • ofMonth

      public static YearHalf.Half ofMonth(int month)
      Gets the Half containing the specified month 获取包含指定月份的Half
      Parameters:
      month - the month (1-12) | 月份(1-12)
      Returns:
      the Half | Half