Class MonthDayHoliday

java.lang.Object
fr.marcwrobel.jbanking.calendar.MonthDayHoliday
All Implemented Interfaces:
Holiday

public final class MonthDayHoliday extends Object implements Holiday
A Holiday occurring the same day and month every year.

This class is useful for modeling holidays like Christmas.

Since:
2.1.0
  • Constructor Details

    • MonthDayHoliday

      public MonthDayHoliday(MonthDay monthDay)
      Create a new holiday using the given MonthDay.
      Parameters:
      monthDay - a non-null MonthDay
      Throws:
      NullPointerException - if the given MonthDay is null
    • MonthDayHoliday

      public MonthDayHoliday(Month month, int dayOfMonth)
      Create a new holiday using the given month and day of month.
      Parameters:
      month - the month-of-year to represent, not null
      dayOfMonth - the day-of-month to represent
      Throws:
      DateTimeException - if the value of any field is out of range, or if the day-of-month is invalid for the month
  • Method Details

    • check

      public boolean check(LocalDate date)
      Description copied from interface: Holiday
      Check whether the given date is an occurrence of this holiday.
      Specified by:
      check in interface Holiday
      Parameters:
      date - the date to check.
      Returns:
      true if the given date is an occurrence of this holiday, false otherwise.
      See Also:
    • 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