Module org.holiday.calendar.western
Package org.holiday.calendar.observance
Class AbstractObservance
java.lang.Object
org.holiday.calendar.observance.AbstractObservance
- Direct Known Subclasses:
AutumnalEquinoxDay,BankHoliday,ChineseNewYearDay,ChineseNewYearFirstDay,ChineseNewYearSecondDay,ComingOfAgeDay,CompositeObservance,DayAfterThanksgiving,Deepavali,DragonBoatFestival,EmperorsBirthday,HariRayaHaji,HariRayaPuasa,KingsBirthday,MarineDay,MidAutumnFestival,OrthodoxEaster,QingmingFestival,RespectForTheAgedDay,SportsDay,VernalEquinoxDay,VesakDay,VictoryInEuropeDay,WesternEaster
Abstract base class for
Observance implementations, providing
standard null-guard and year-validity logic.- Author:
- Dave Joyce
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal LocalDateprotected abstract LocalDatecomputeDate(int year) Compute the date for this observance in the given year.protected booleanisValidYear(int year) Determine whether this observance applies in the given year.final booleanDetermines whether this observance applies to the specified year.
-
Constructor Details
-
AbstractObservance
public AbstractObservance()
-
-
Method Details
-
apply
-
test
Description copied from interface:ObservanceDetermines whether this observance applies to the specified year.- Specified by:
testin interfaceObservance- Specified by:
testin interfacePredicate<Integer>- Parameters:
year- year of potential observance- Returns:
- true if the input year applies for this observance, otherwise false
-
computeDate
Compute the date for this observance in the given year. Only called whenisValidYear(int)returnstrue.- Parameters:
year- the year for which to compute the date- Returns:
- computed holiday date
-
isValidYear
protected boolean isValidYear(int year) Determine whether this observance applies in the given year. Defaults totrue(all years are valid).- Parameters:
year- the year to test- Returns:
trueif this observance applies
-