Package fr.marcwrobel.jbanking.calendar
Class RelativeHoliday
- java.lang.Object
-
- fr.marcwrobel.jbanking.calendar.RelativeHoliday
-
- All Implemented Interfaces:
Holiday
public final class RelativeHoliday extends Object implements Holiday
AHolidayrelative to anotherHolidaywith a fixed day shift.This class is modeling holidays like easter monday or good friday.
- Since:
- 2.1.0
- Author:
- Marc Wrobel
-
-
Constructor Summary
Constructors Constructor Description RelativeHoliday(Holiday base, int plusDays)Create a new holiday using the givenbase holidayand the given number of days as the shift.
-
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
-
RelativeHoliday
public RelativeHoliday(Holiday base, int plusDays)
Create a new holiday using the givenbase holidayand the given number of days as the shift.- Parameters:
base- a non-null holiday to use as a base.plusDays- a number of days to use as the shift (can be negative)- Throws:
NullPointerException- if the given base isnull
-
-
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)
-
-