Package fr.marcwrobel.jbanking.calendar
Class DayOfWeekInMonthHoliday
- java.lang.Object
-
- fr.marcwrobel.jbanking.calendar.DayOfWeekInMonthHoliday
-
- All Implemented Interfaces:
Holiday
public final class DayOfWeekInMonthHoliday extends Object implements Holiday
AHolidayoccurring the same day of the week in a month every year.This class is using
TemporalAdjusters.dayOfWeekInMonth(int, DayOfWeek)under the hood.This class is useful for modeling holidays like Martin Luther King Jr. Day.
- Since:
- 2.1.0
- Author:
- Marc Wrobel
- See Also:
TemporalAdjusters.dayOfWeekInMonth(int, DayOfWeek)
-
-
Constructor Summary
Constructors Constructor Description DayOfWeekInMonthHoliday(int weekNumber, DayOfWeek dayOfWeek, Month month)
-
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
-
DayOfWeekInMonthHoliday
public DayOfWeekInMonthHoliday(int weekNumber, DayOfWeek dayOfWeek, Month month)- Parameters:
weekNumber- the week within the month, unbounded but typically from -5 to 5dayOfWeek- a non-nullDayOfWeekmonth- a non-nullMonth- Throws:
NullPointerException- if the givenMonthDayisnull
-
-
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)
-
-