Class ShiftedHoliday

  • All Implemented Interfaces:
    Holiday

    public final class ShiftedHoliday
    extends Object
    implements Holiday
    A Holiday relative to another Holiday with a fixed day shift.

    This class is modeling holidays like the Independence Day in the United States.

    Since:
    2.1.0
    Author:
    Marc Wrobel
    • Constructor Detail

      • ShiftedHoliday

        public ShiftedHoliday​(Holiday base,
                              ShiftingStrategy strategy)
        Create a new holiday using the given base holiday and shifting strategy.
        Parameters:
        base - a non-null holiday to use as a base.
        strategy - a non-null strategy to use as for shifting dates.
        Throws:
        NullPointerException - if the either base or strategy is null
    • 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