Class 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
    Author:
    Marc Wrobel
    • Constructor Detail

      • 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 Detail

      • 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:
        Holiday.check(LocalDate)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object