public interface PeriodAdditionConvention extends Named
The purpose of this convention is to define how to handle the addition of a period. The default implementations include two different end-of-month rules. The convention is generally only applicable for month-based periods.
The most common implementations are provided in PeriodAdditionConventions
.
Additional implementations may be added by implementing this interface.
All implementations of this interface must be immutable and thread-safe.
Modifier and Type | Method and Description |
---|---|
LocalDate |
adjust(LocalDate baseDate,
Period period,
HolidayCalendar calendar)
Adjusts the base date, adding the period and applying the convention rule.
|
static ExtendedEnum<PeriodAdditionConvention> |
extendedEnum()
Gets the extended enum helper.
|
String |
getName()
Gets the name that uniquely identifies this convention.
|
boolean |
isMonthBased()
Checks whether the convention requires a month-based period.
|
static PeriodAdditionConvention |
of(String uniqueName)
Obtains an instance from the specified unique name.
|
static PeriodAdditionConvention of(String uniqueName)
uniqueName
- the unique nameIllegalArgumentException
- if the name is not knownstatic ExtendedEnum<PeriodAdditionConvention> extendedEnum()
This helper allows instances of the convention to be looked up. It also provides the complete set of available instances.
LocalDate adjust(LocalDate baseDate, Period period, HolidayCalendar calendar)
The adjustment occurs in two steps. First, the period is added to the based date to create the end date. Second, the end date is adjusted by the convention rules.
baseDate
- the base date to add toperiod
- the period to addcalendar
- the holiday calendar to useboolean isMonthBased()
A month-based period contains only months and/or years, and not days.
String getName()
This name is used in serialization and can be parsed using of(String)
.
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.