java.lang.Object
org.holiday.calendar.FixedHoliday
- All Implemented Interfaces:
Holiday
A holiday which occurs on the same date every year. Examples of a fixed
holiday are
New Year's Day
and a national independence day.
- Author:
- Dave Joyce
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.holiday.calendar.Holiday
Holiday.HolidayBuilder, Holiday.Type -
Constructor Summary
ConstructorsConstructorDescriptionFixedHoliday(String name, String description, String monthAndDay) Construct a new instance of a fixed holiday occurring on the given month and day.FixedHoliday(String name, String description, String monthAndDay, boolean rollable) Construct a new instance of a fixed holiday occurring on the given month and day, with explicit rollable control.FixedHoliday(String name, String description, MonthDay monthDay, boolean rollable) Canonical constructor.FixedHoliday(String name, String description, Month month, int dayOfMonth) Construct a new instance of a fixed holiday occurring on the given month and day.FixedHoliday(String name, String description, Month month, int dayOfMonth, boolean rollable) Construct a new instance of a fixed holiday occurring on the given month and day, with explicit rollable control. -
Method Summary
Modifier and TypeMethodDescriptiondateForYear(int year) Calculate the date of this holiday for the specified year.booleanintGet the description (if any) of this holiday.getMonth()getName()Get the name of this holiday.inthashCode()booleanDetermine if this holiday supports date rolling for actual observance on a holiday calendar.toString()
-
Constructor Details
-
FixedHoliday
Construct a new instance of a fixed holiday occurring on the given month and day. The constructed holiday will berollableby default. -
FixedHoliday
Construct a new instance of a fixed holiday occurring on the given month and day. The constructed holiday will berollableby default. -
FixedHoliday
Construct a new instance of a fixed holiday occurring on the given month and day, with explicit rollable control. -
FixedHoliday
Construct a new instance of a fixed holiday occurring on the given month and day, with explicit rollable control. -
FixedHoliday
Canonical constructor.
-
-
Method Details
-
getName
Description copied from interface:HolidayGet the name of this holiday. -
getDescription
Description copied from interface:HolidayGet the description (if any) of this holiday.- Specified by:
getDescriptionin interfaceHoliday- Returns:
- holiday description
-
isRollable
public boolean isRollable()Description copied from interface:HolidayDetermine if this holiday supports date rolling for actual observance on a holiday calendar.- Specified by:
isRollablein interfaceHoliday- Returns:
trueif the date of occurrence for this holiday may be rolled for observance,falseotherwise
-
getMonthDay
-
getMonth
-
getDayOfMonth
public int getDayOfMonth() -
dateForYear
Description copied from interface:HolidayCalculate the date of this holiday for the specified year. The date returned by this method may be adjusted to a different date of observance by the associatedholiday calendar.- Specified by:
dateForYearin interfaceHoliday- Parameters:
year- full calendar year (e.g. 1977, 2021)- Returns:
- date of this holiday, or
emptyif not observed on the specified year
-
equals
-
hashCode
public int hashCode() -
toString
-