Class SpecialAnniversary

java.lang.Object
org.holiday.calendar.SpecialAnniversary
All Implemented Interfaces:
Holiday

public final class SpecialAnniversary extends Object implements Holiday
A holiday which commemorates a particular anniversary of an event. Example of a special anniversary is a Jubilee for a reigning monarch.
Author:
Dave Joyce
  • Constructor Details

    • SpecialAnniversary

      public SpecialAnniversary(String name, String description, LocalDate anniversaryDate, boolean rollable)
    • SpecialAnniversary

      public SpecialAnniversary(String name, String description, LocalDate anniversaryDate)
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Holiday
      Get the name of this holiday.
      Specified by:
      getName in interface Holiday
      Returns:
      holiday name
    • getDescription

      public String getDescription()
      Description copied from interface: Holiday
      Get the description (if any) of this holiday.
      Specified by:
      getDescription in interface Holiday
      Returns:
      holiday description
    • isRollable

      public boolean isRollable()
      Description copied from interface: Holiday
      Determine if this holiday supports date rolling for actual observance on a holiday calendar.
      Specified by:
      isRollable in interface Holiday
      Returns:
      true if the date of occurrence for this holiday may be rolled for observance, false otherwise
    • getAnniversaryDate

      public LocalDate getAnniversaryDate()
    • getMonth

      public Month getMonth()
    • getDayOfMonth

      public int getDayOfMonth()
    • getYear

      public int getYear()
    • dateForYear

      public Optional<LocalDate> dateForYear(int year)
      Description copied from interface: Holiday
      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.
      Specified by:
      dateForYear in interface Holiday
      Parameters:
      year - full calendar year (e.g. 1977, 2021)
      Returns:
      date of this holiday, or empty if not observed on the specified year
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object