Class HolidayCalendar.Builder

java.lang.Object
cloud.opencode.base.date.holiday.HolidayCalendar.Builder
Enclosing class:
HolidayCalendar

public static class HolidayCalendar.Builder extends Object
Builder for HolidayCalendar HolidayCalendar构建器
Since:
JDK 25, opencode-base-date V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • name

      public HolidayCalendar.Builder name(String name)
      Sets the calendar name 设置日历名称
      Parameters:
      name - the name | 名称
      Returns:
      this builder | 此构建器
    • addHoliday

      public HolidayCalendar.Builder addHoliday(Holiday holiday)
      Adds a holiday 添加假日
      Parameters:
      holiday - the holiday | 假日
      Returns:
      this builder | 此构建器
    • addHolidays

      public HolidayCalendar.Builder addHolidays(Collection<Holiday> holidays)
      Adds multiple holidays 添加多个假日
      Parameters:
      holidays - the holidays | 假日集合
      Returns:
      this builder | 此构建器
    • addSpecialWorkday

      public HolidayCalendar.Builder addSpecialWorkday(LocalDate date)
      Adds a special workday 添加特殊工作日
      Parameters:
      date - the date | 日期
      Returns:
      this builder | 此构建器
    • addSpecialWorkdays

      public HolidayCalendar.Builder addSpecialWorkdays(Collection<LocalDate> dates)
      Adds multiple special workdays 添加多个特殊工作日
      Parameters:
      dates - the dates | 日期集合
      Returns:
      this builder | 此构建器
    • addHolidayRange

      public HolidayCalendar.Builder addHolidayRange(LocalDate start, LocalDate end, String name, String chineseName)
      Adds every date in the closed-interval range as a holiday with the given name(s). 将闭区间内的每个日期添加为指定名称的假日。

      Both endpoints are inclusive. This is the natural input shape for the State-Council holiday model where an event such as Labor Day is announced as "5月1日至5月5日放假".

      两端均包含。此方法对应国务院类公告(如"5月1日至5月5日放假")的天然输入形态。

      Parameters:
      start - start date (inclusive) | 起始日期(包含)
      end - end date (inclusive) | 结束日期(包含)
      name - holiday English name | 假日英文名称
      chineseName - holiday Chinese name (nullable) | 假日中文名称(可为 null)
      Returns:
      this builder | 此构建器
      Since:
      opencode-base-date V1.0.4
    • addSpecialWorkdayRange

      public HolidayCalendar.Builder addSpecialWorkdayRange(LocalDate start, LocalDate end)
      Adds every date in the closed-interval range as a special workday (调休补班日). 将闭区间内的每个日期添加为特殊工作日(调休补班日)。

      Both endpoints are inclusive.

      两端均包含。

      Parameters:
      start - start date (inclusive) | 起始日期(包含)
      end - end date (inclusive) | 结束日期(包含)
      Returns:
      this builder | 此构建器
      Since:
      opencode-base-date V1.0.4
    • weekendDays

      public HolidayCalendar.Builder weekendDays(Set<DayOfWeek> weekendDays)
      Sets the weekend days 设置周末天数
      Parameters:
      weekendDays - the weekend days | 周末天数
      Returns:
      this builder | 此构建器
    • build

      public HolidayCalendar build()
      Builds the HolidayCalendar 构建HolidayCalendar
      Returns:
      the HolidayCalendar | 假日日历