Package fr.marcwrobel.jbanking.calendar
Class YearRangeHoliday
- java.lang.Object
-
- fr.marcwrobel.jbanking.calendar.YearRangeHoliday
-
- All Implemented Interfaces:
Holiday
public final class YearRangeHoliday extends Object implements Holiday
AHolidaythat is valid only for a given range or years.This class is useful for modeling holidays like the German reformation day that was exceptionally a national holiday in 2017 because of 500 anniversary of the religious reformation in Europe.
- Since:
- 2.1.0
- Author:
- Marc Wrobel
-
-
Constructor Summary
Constructors Constructor Description YearRangeHoliday(Holiday base, long from, long to)Create a new holiday using the given base and years of validity.YearRangeHoliday(Holiday base, ValueRange validityRange)Create a new holiday using the given base and years of validity.
-
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
-
YearRangeHoliday
public YearRangeHoliday(Holiday base, ValueRange validityRange)
Create a new holiday using the given base and years of validity.- Parameters:
base- a non-null holiday to use as a base.validityRange- a non-null validity range.- Throws:
NullPointerException- if eitherbaseorvalidityRangeisnull
-
YearRangeHoliday
public YearRangeHoliday(Holiday base, long from, long to)
Create a new holiday using the given base and years of validity.- Parameters:
base- a non-null holiday to use as a base.from- the minimum year of validity (included)to- the maximum year of validity (included)- Throws:
NullPointerException- ifbaseisnullIllegalArgumentException- if from is greater than to
-
-
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)
-
-