Business Day Calendar
The IBusinessDayCalendar
interface lets you check if a day is closed or open. It is used to compute things
such as end of month, end of year, and so on. It also adjusts a duration to set the destination day on an open day.
The interface is very simple as it only provides one function: boolean isBusinessDay(LocalDate date)
.
The common library provides one implementation of the class that computes the open days for the European settlement service, Target.
The implementation is called TargetBusinessDayConvention
, and follows the Target rules.
This implementation provide some interesting bits of code like the easter date computation.
@NonNull LocalDate TargetBusinessDayConvention::easterDate(@NonNull LocalDate current); // Only the year is used
The implementation of an IBusinessDayCalendar
should be retrieved from a bean / service implementing the IBusinessDayCalendarFactory
.
The factory requires the following:
- A pivot
- A database. This is optional, it could be null on a query cube.
- Leaf levels, containing some business-specific data, such as the calendar to select.
The Atoti extensions that need the IBusinessDayCalendarFactory
should implement the IBusinessDayCalendarAware
so they will receive the factory at creation.
The project should call:
injectAll(IBusinessDayCalendarAware.class, businessDayCalendarFactory);
The leaf coordinates are passed to the IMaturityConverter
interface.
The leaf coordinates used by the UnfilteredDateShiftPostProcessor
are computed by the LocationFunction
:
- The leafs are fetched with the
ICustomParameters
service with the key “UnfilteredDateShiftPostProcessor”. - The retrieved lambda function is passed to the function
IBusinessDayCalendarFactory::updateLeafCoordinatesFunction()
to be adjusted. TheLocationFunction
object provides the extra levels to fetch and a way to convert a location into the leaf levels.