Package fr.marcwrobel.jbanking.calendar
Class MovedHoliday
- java.lang.Object
-
- fr.marcwrobel.jbanking.calendar.MovedHoliday
-
- All Implemented Interfaces:
Holiday
public final class MovedHoliday extends Object implements Holiday
AHolidaythat has been punctually moved to another day.This class is useful for modeling holidays like the May Day in the United Kingdom, that has been exceptionally moved from 2020-05-04 to 2020-05-08 in 2020 to coincide with Victory in Europe Day.
- Since:
- 2.1.0
- Author:
- Marc Wrobel
-
-
Constructor Summary
Constructors Constructor Description MovedHoliday(Holiday base, LocalDate... replacements)Create a new holiday using the given base and replacementsMap.MovedHoliday(MonthDay base, MonthDay replacement, int... replacedYears)Create a new holiday using the given baseMonthDayHoliday, the replacement dayMonthDayand the years when the replacement must occur.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheck(LocalDate date)Check whether the given date is an occurrence of this holiday.booleanequals(Object o)inthashCode()StringtoString()
-
-
-
Constructor Detail
-
MovedHoliday
public MovedHoliday(Holiday base, LocalDate... replacements)
Create a new holiday using the given base and replacementsMap.The replacements are expressed as
k1, v1, k2, v2, ..., kn, vnwhere kn are the original dates dans vn are the replacement.- Parameters:
base- a non-null holiday to use as a basereplacements- replacements, expressed as key / value- Throws:
NullPointerException- ifbaseis null
-
MovedHoliday
public MovedHoliday(MonthDay base, MonthDay replacement, int... replacedYears)
Create a new holiday using the given baseMonthDayHoliday, the replacement dayMonthDayand the years when the replacement must occur.This constructor build a
MonthDayHolidayinternally.- Parameters:
base- a non-null holiday to use as a base.replacement- the replacement expressed as aMonthDayreplacedYears- the years when the holiday must be replaced- Throws:
NullPointerException- ifbaseis null
-
-
Method Detail
-
check
public boolean check(LocalDate date)
Description copied from interface:HolidayCheck whether the given date is an occurrence of this holiday.- Specified by:
checkin interfaceHoliday- Parameters:
date- the date to check.- Returns:
trueif the given date is an occurrence of this holiday,falseotherwise.- See Also:
Holiday.check(LocalDate)
-
-