Class ShiftedHoliday

java.lang.Object
fr.marcwrobel.jbanking.calendar.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
  • Constructor Details

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