Record Class ChinaHolidayCalendar.DayInfo

java.lang.Object
java.lang.Record
cloud.opencode.base.date.holiday.ChinaHolidayCalendar.DayInfo
Record Components:
date - the date | 日期
kind - the day kind | 日期类别
holidayName - the holiday English name (null if not a holiday or makeup) | 假期英文名(普通工作日/周末为 null)
chineseName - the holiday Chinese name (null if not a holiday or makeup) | 假期中文名(普通工作日/周末为 null)
Enclosing class:
ChinaHolidayCalendar

public static record ChinaHolidayCalendar.DayInfo(LocalDate date, ChinaHolidayCalendar.DayKind kind, String holidayName, String chineseName) extends Record
Per-day classification under State-Council holiday rules. 国务院假期规则下单日的分类信息。
Since:
JDK 25, opencode-base-date V1.0.4
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • DayInfo

      public DayInfo(LocalDate date, ChinaHolidayCalendar.DayKind kind, String holidayName, String chineseName)
      Creates an instance of a DayInfo record class.
      Parameters:
      date - the value for the date record component
      kind - the value for the kind record component
      holidayName - the value for the holidayName record component
      chineseName - the value for the chineseName record component
  • Method Details

    • isWorkday

      public boolean isWorkday()
      Whether this day is a workday. 是否为工作日。
      Returns:
      true if workday | 工作日返回 true
    • isRestDay

      public boolean isRestDay()
      Whether this day is a rest day. 是否为休息日。
      Returns:
      true if rest day | 休息日返回 true
    • localizedReason

      public String localizedReason()
      Localized reason: Chinese name of the holiday/makeup that triggered this day, falling back to English holidayName() if chineseName() is null. Returns null for normal workdays and weekends. 本地化原因:触发该日的节假日中文名(chineseName() 为 null 时回退英文名); 普通工作日和周末返回 null。
      Returns:
      localized reason or null | 本地化原因或 null
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • date

      public LocalDate date()
      Returns the value of the date record component.
      Returns:
      the value of the date record component
    • kind

      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • holidayName

      public String holidayName()
      Returns the value of the holidayName record component.
      Returns:
      the value of the holidayName record component
    • chineseName

      public String chineseName()
      Returns the value of the chineseName record component.
      Returns:
      the value of the chineseName record component