Record Class ChinaHolidayCalendar.CalendarRow

java.lang.Object
java.lang.Record
cloud.opencode.base.date.holiday.ChinaHolidayCalendar.CalendarRow
Record Components:
date - the date — 日期 (null if ChinaHolidayCalendar.CalendarField.DATE not selected)
dayOfWeek - the day of week — 星期几 (null if ChinaHolidayCalendar.CalendarField.DAY_OF_WEEK not selected)
kind - the day kind — 日期类别 (null if ChinaHolidayCalendar.CalendarField.STATUS not selected)
reason - localized holiday name causing the rest or makeup — 引起休息/调休的假期本地化名称 (null if ChinaHolidayCalendar.CalendarField.REASON not selected, or if no reason applies)
Enclosing class:
ChinaHolidayCalendar

public static record ChinaHolidayCalendar.CalendarRow(LocalDate date, DayOfWeek dayOfWeek, ChinaHolidayCalendar.DayKind kind, String reason) extends Record
One row of a calendar listing. Unselected fields are null. 日历输出的一行。未选中的列为 null

reason is the localized name of the holiday that triggered the rest/makeup-workday. For normal workdays and normal weekends the field is always null (i.e. no reason).

reason 为引起休息或调休的节假日本地化名称。对于正常工作日和正常周末,该字段始终为 null(无原因)。

Since:
JDK 25, opencode-base-date V1.0.4
Author:
Leon Soo www.LeonSoo.com
  • Constructor Details

    • CalendarRow

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

    • isWorkday

      public boolean isWorkday()
      Convenience: whether this row represents a workday (requires ChinaHolidayCalendar.CalendarField.STATUS). 便捷方法:判断该行是否为工作日(需选中 ChinaHolidayCalendar.CalendarField.STATUS)。
      Returns:
      true if workday | 工作日返回 true
      Throws:
      IllegalStateException - if STATUS was not selected | STATUS 未选中时抛出
    • isRestDay

      public boolean isRestDay()
      Convenience: whether this row represents a rest day (requires ChinaHolidayCalendar.CalendarField.STATUS). 便捷方法:判断该行是否为休息日(需选中 ChinaHolidayCalendar.CalendarField.STATUS)。
      Returns:
      true if rest day | 休息日返回 true
      Throws:
      IllegalStateException - if STATUS was not selected | STATUS 未选中时抛出
    • 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
    • dayOfWeek

      public DayOfWeek dayOfWeek()
      Returns the value of the dayOfWeek record component.
      Returns:
      the value of the dayOfWeek record component
    • kind

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

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