net.corda.core.contracts / BusinessCalendar

BusinessCalendar

open class BusinessCalendar

A business calendar performs date calculations that take into account national holidays and weekends. This is a typical feature of financial contracts, in which a business may not want a payment event to fall on a day when no staff are around to handle problems.



Exceptions

UnknownCalendar class UnknownCalendar : Exception

Properties

holidayDates val holidayDates: List<LocalDate>

Functions

applyRollConvention open fun applyRollConvention(testDate: LocalDate, dateRollConvention: DateRollConvention): LocalDate
equals open fun equals(other: Any?): Boolean
hashCode open fun hashCode(): Int
isWorkingDay open fun isWorkingDay(date: LocalDate): Boolean
moveBusinessDays fun moveBusinessDays(date: LocalDate, direction: DateRollDirection, i: Int): LocalDate

Returns a date which is the inbound date plus/minus a given number of business days. TODO: Make more efficient if necessary

Companion Object Properties

TEST_CALENDAR_DATA val TEST_CALENDAR_DATA: <ERROR CLASS>
calendars val calendars: <ERROR CLASS>

Companion Object Functions

createGenericSchedule fun createGenericSchedule(startDate: LocalDate, period: Frequency, calendar: BusinessCalendar = getInstance(), dateRollConvention: DateRollConvention = DateRollConvention.Following, noOfAdditionalPeriods: Int = Integer.MAX_VALUE, endDate: LocalDate? = null, periodOffset: Int? = null): List<LocalDate>

Calculates an event schedule that moves events around to ensure they fall on working days.

getInstance fun getInstance(vararg calname: String): BusinessCalendar

Returns a business calendar that combines all the named holiday calendars into one list of holiday dates.

getOffsetDate fun getOffsetDate(startDate: LocalDate, period: Frequency, steps: Int = 1): LocalDate

Calculates the date from @startDate moving forward @steps of time size @period. Does not apply calendar logic / roll conventions.

parseDateFromString fun parseDateFromString(it: String): LocalDate

Parses a date of the form YYYY-MM-DD, like 2016-01-10 for 10th Jan.