Module org.holiday.calendar.core
Package org.holiday.calendar.observance
package org.holiday.calendar.observance
Base classes for
Observance
implementations, used throughout the regional calendar modules.
AbstractObservance supplies
standard null-guard handling and a year-validity hook, leaving subclasses
to implement only computeDate(int):
public class Juneteenth extends AbstractObservance {
protected LocalDate computeDate(int year) {
return LocalDate.of(year, Month.JUNE, 19);
}
protected boolean isValidYear(int year) {
return year >= 2021;
}
}
CompositeObservance extends
AbstractObservance for holidays computed relative to another
observance (most commonly an Easter algorithm), delegating year validity to
that base observance — see the observance.christian package in the
western module for examples such as Good Friday and Easter Monday.
- Author:
- Dave Joyce
-
ClassesClassDescriptionAbstract base class for
Observanceimplementations, providing standard null-guard and year-validity logic.Abstract base class for observances that are computed relative to anotherObservance(the base).