Interface Holiday

All Known Implementing Classes:
FixedHoliday, FloatingHoliday, SpecialAnniversary

public sealed interface Holiday permits FixedHoliday, FloatingHoliday, SpecialAnniversary
An official day on which work does not occur. A holiday may be traditional, religious, or governmental in origin. Its date of occurrence may be fixed, moveable, or otherwise computed.

Permitted subtypes determine the method of holiday date calculation.

Author:
Dave Joyce
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Builder for configurable construction of Holiday objects.
    static enum 
    Enumerated type of Holiday.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get a new builder object for construction of a configured Holiday instance to be used with one or more holiday calendars.
    dateForYear(int year)
    Calculate the date of this holiday for the specified year.
    Get the description (if any) of this holiday.
    Get the name of this holiday.
    boolean
    Determine if this holiday supports date rolling for actual observance on a holiday calendar.
  • Method Details

    • builder

      static Holiday.HolidayBuilder builder()
      Get a new builder object for construction of a configured Holiday instance to be used with one or more holiday calendars.
      Returns:
      new Holiday builder instance
    • getName

      String getName()
      Get the name of this holiday.
      Returns:
      holiday name
    • getDescription

      String getDescription()
      Get the description (if any) of this holiday.
      Returns:
      holiday description
    • isRollable

      boolean isRollable()
      Determine if this holiday supports date rolling for actual observance on a holiday calendar.
      Returns:
      true if the date of occurrence for this holiday may be rolled for observance, false otherwise
    • dateForYear

      Optional<LocalDate> dateForYear(int year)
      Calculate the date of this holiday for the specified year. The date returned by this method may be adjusted to a different date of observance by the associated holiday calendar.
      Parameters:
      year - full calendar year (e.g. 1977, 2021)
      Returns:
      date of this holiday, or empty if not observed on the specified year