Class SuppressedHoliday

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

public final class SuppressedHoliday extends Object implements Holiday
A Holiday that has been punctually suppressed.

This class is useful for modeling holidays like the Spring public holiday in the United Kingdom, that has been exceptionally suppressed in 2002 and 2012 for the golden and diamond jubilee.

Since:
2.1.0
  • Constructor Details

    • SuppressedHoliday

      public SuppressedHoliday(Holiday base, Collection<Integer> suppressedYears)
      Create a new holiday using the given base and suppressed years.

      The replacements are expressed as k1, v1, k2, v2, ..., kn, vn where kn are the original dates dans vn are the replacement.

      Parameters:
      base - a non-null holiday to use as a base.
      suppressedYears - a list of year the holiday has been suppressed
      Throws:
      NullPointerException - if base is null
    • SuppressedHoliday

      public SuppressedHoliday(Holiday base, Integer... suppressedYears)
      Create a new holiday using the given base and suppressed years.

      The replacements are expressed as k1, v1, k2, v2, ..., kn, vn where kn are the original dates dans vn are the replacement.

      Parameters:
      base - a non-null holiday to use as a base.
      suppressedYears - a list of year the holiday has been suppressed
      Throws:
      NullPointerException - if base 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