- All Known Implementing Classes:
AbstractHolidayCalendarService
HolidayCalendar
object assigned to a unique code identifier.- Author:
- Dave Joyce
-
Method Summary
Modifier and TypeMethodDescriptiondefault OptionalIntReturns the latest year for which this service provides authoritative holiday data for all lookup-table-backed holidays in this calendar.default StringgetCode()Get the short code identifier for the holiday calendar provided by this service.Get the holiday calendar object provided by this service.default StringGet the human-readable name of the region for this holiday calendar.booleanisProvided(String code) Determine if this service provides theHolidayCalendarfor the specified code.
-
Method Details
-
isProvided
Determine if this service provides theHolidayCalendarfor the specified code.- Parameters:
code- short code identifier of desired holiday calendar- Returns:
- true if this service provides the holiday calendar for the given code, false otherwise
-
getHolidayCalendar
HolidayCalendar getHolidayCalendar()Get the holiday calendar object provided by this service.- Returns:
- holiday calendar object
-
getCode
Get the short code identifier for the holiday calendar provided by this service. Returnsnullif not implemented.- Returns:
- short code identifier, e.g. "US", "UK"
-
getRegion
Get the human-readable name of the region for this holiday calendar. Returnsnullif not implemented.- Returns:
- region name, e.g. "United States National Holidays"
-
dataValidThrough
Returns the latest year for which this service provides authoritative holiday data for all lookup-table-backed holidays in this calendar.An empty result indicates that every holiday in this calendar is computed algorithmically and therefore has no known upper bound — all years are equally authoritative (e.g. Easter-based or nth-weekday rules).
A non-empty result indicates that one or more holidays are backed by a finite, officially-gazetted lookup table. The returned value is the last year for which all such tables have been populated. For years beyond this value,
HolidayCalendar.calculate(int)will silently omit those holidays without throwing an exception. This method is an advisory signal only — it does not altercalculate()behaviour. Callers that require complete data should verify that the requested year does not exceed this bound before invokingcalculate().Implementations backed by lookup tables must override this method and return
OptionalInt.of(lastTableYear), wherelastTableYearis the minimum of the last year covered by each individual lookup table in the calendar. Subclasses ofAbstractHolidayCalendarServicethat use lookup tables should override this method accordingly.- Returns:
- the last year for which data is fully authoritative, or
OptionalInt.empty()if the calendar is fully algorithmic with no known upper bound
-