java.lang.Object
org.holiday.calendar.HolidayCalendarFactory
Factory for creation of
HolidayCalendar objects.- Author:
- Dave Joyce
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate (or return cached)HolidayCalendaridentified by the specified code.dataValidThrough(String code) Returns the latest year for which the calendar identified bycodeprovides authoritative data, by delegating toHolidayCalendarService.dataValidThrough()on the service that provides that code.getService(String code) Get theHolidayCalendarServiceobject that provides theHolidayCalendarobject identified by the specified code.List all calendar codes available from registered services.
-
Constructor Details
-
HolidayCalendarFactory
public HolidayCalendarFactory()
-
-
Method Details
-
create
Create (or return cached)HolidayCalendaridentified by the specified code.- Parameters:
code- short code identifier of desired holiday calendar- Returns:
- holiday calendar
- Throws:
HolidayCalendarNotFoundException- if code does not match any available holiday calendar
-
getService
Get theHolidayCalendarServiceobject that provides theHolidayCalendarobject identified by the specified code.- Parameters:
code- short code identifier of desired holiday calendar- Returns:
- holiday calendar service
- Throws:
HolidayCalendarNotFoundException- if code does not match any available holiday calendar service
-
listAvailableCodes
List all calendar codes available from registered services.- Returns:
- sorted list of available calendar codes
-
dataValidThrough
Returns the latest year for which the calendar identified bycodeprovides authoritative data, by delegating toHolidayCalendarService.dataValidThrough()on the service that provides that code.An empty result means the calendar is fully algorithmic with no known upper bound. A non-empty result means at least one holiday in the calendar is backed by a lookup table that ends at the returned year; calculations for later years will silently omit those holidays.
- Parameters:
code- short code identifier of the desired holiday calendar- Returns:
- the last authoritative year, or
OptionalInt.empty()if the calendar is fully algorithmic with no known upper bound - Throws:
HolidayCalendarNotFoundException- ifcodedoes not match any registered service
-