Class HolidayCalendar.Builder
java.lang.Object
cloud.opencode.base.date.holiday.HolidayCalendar.Builder
- Enclosing class:
HolidayCalendar
Builder for HolidayCalendar
HolidayCalendar构建器
- Since:
- JDK 25, opencode-base-date V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionaddHoliday(Holiday holiday) Adds a holiday 添加假日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).addHolidays(Collection<Holiday> holidays) Adds multiple holidays 添加多个假日addSpecialWorkday(LocalDate date) Adds a special workday 添加特殊工作日addSpecialWorkdayRange(LocalDate start, LocalDate end) Adds every date in the closed-interval range as a special workday (调休补班日).addSpecialWorkdays(Collection<LocalDate> dates) Adds multiple special workdays 添加多个特殊工作日build()Builds the HolidayCalendar 构建HolidayCalendarSets the calendar name 设置日历名称weekendDays(Set<DayOfWeek> weekendDays) Sets the weekend days 设置周末天数
-
Method Details
-
name
Sets the calendar name 设置日历名称- Parameters:
name- the name | 名称- Returns:
- this builder | 此构建器
-
addHoliday
Adds a holiday 添加假日- Parameters:
holiday- the holiday | 假日- Returns:
- this builder | 此构建器
-
addHolidays
Adds multiple holidays 添加多个假日- Parameters:
holidays- the holidays | 假日集合- Returns:
- this builder | 此构建器
-
addSpecialWorkday
Adds a special workday 添加特殊工作日- Parameters:
date- the date | 日期- Returns:
- this builder | 此构建器
-
addSpecialWorkdays
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
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
Sets the weekend days 设置周末天数- Parameters:
weekendDays- the weekend days | 周末天数- Returns:
- this builder | 此构建器
-
build
Builds the HolidayCalendar 构建HolidayCalendar- Returns:
- the HolidayCalendar | 假日日历
-