public final class TenorAdjustment extends Object implements Resolvable<DateAdjuster>, org.joda.beans.ImmutableBean, Serializable
This adjustment adds a Tenor to the input date using an addition convention,
followed by an adjustment to ensure the result is a valid business day.
Addition is performed using standard calendar addition.
It is not possible to add a number of business days using this class.
See DaysAdjustment for an alternative that can handle addition of business days.
There are two steps in the calculation:
In step one, the period is added using the specified PeriodAdditionConvention.
In step two, the result of step one is optionally adjusted to be a business day
using a BusinessDayAdjustment.
For example, a rule represented by this class might be: "the end date is 5 years after the start date, with end-of-month rule based on the last business day of the month, adjusted to be a valid London business day using the 'ModifiedFollowing' convention".
| Modifier and Type | Class and Description |
|---|---|
static class |
TenorAdjustment.Builder
The bean-builder for
TenorAdjustment. |
static class |
TenorAdjustment.Meta
The meta-bean for
TenorAdjustment. |
| Modifier and Type | Method and Description |
|---|---|
LocalDate |
adjust(LocalDate date,
ReferenceData refData)
Adjusts the date, adding the tenor and then applying the business day adjustment.
|
static TenorAdjustment.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
boolean |
equals(Object obj) |
PeriodAdditionConvention |
getAdditionConvention()
Gets the addition convention to apply.
|
BusinessDayAdjustment |
getAdjustment()
Gets the business day adjustment that is performed to the result of the addition.
|
Tenor |
getTenor()
Gets the tenor to be added.
|
int |
hashCode() |
static TenorAdjustment.Meta |
meta()
The meta-bean for
TenorAdjustment. |
TenorAdjustment.Meta |
metaBean() |
static TenorAdjustment |
of(Tenor tenor,
PeriodAdditionConvention additionConvention,
BusinessDayAdjustment adjustment)
Obtains an instance that can adjust a date by the specified tenor.
|
static TenorAdjustment |
ofLastBusinessDay(Tenor tenor,
BusinessDayAdjustment adjustment)
Obtains an instance that can adjust a date by the specified tenor using the
last business day of month convention.
|
static TenorAdjustment |
ofLastDay(Tenor tenor,
BusinessDayAdjustment adjustment)
Obtains an instance that can adjust a date by the specified tenor using the
last day of month convention.
|
DateAdjuster |
resolve(ReferenceData refData)
Resolves this adjustment using the specified reference data, returning an adjuster.
|
TenorAdjustment.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString()
Returns a string describing the adjustment.
|
public static TenorAdjustment of(Tenor tenor, PeriodAdditionConvention additionConvention, BusinessDayAdjustment adjustment)
When adjusting a date, the specified tenor is added to the input date. The business day adjustment will then be used to ensure the result is a valid business day.
tenor - the tenor to add to the input dateadditionConvention - the convention used to perform the additionadjustment - the business day adjustment to apply to the result of the additionpublic static TenorAdjustment ofLastDay(Tenor tenor, BusinessDayAdjustment adjustment)
When adjusting a date, the specified tenor is added to the input date. The business day adjustment will then be used to ensure the result is a valid business day.
The period must consist only of months and/or years.
tenor - the tenor to add to the input dateadjustment - the business day adjustment to apply to the result of the additionpublic static TenorAdjustment ofLastBusinessDay(Tenor tenor, BusinessDayAdjustment adjustment)
When adjusting a date, the specified tenor is added to the input date. The business day adjustment will then be used to ensure the result is a valid business day.
The period must consist only of months and/or years.
tenor - the tenor to add to the input dateadjustment - the business day adjustment to apply to the result of the additionpublic LocalDate adjust(LocalDate date, ReferenceData refData)
The calculation is performed in two steps.
Step one, use PeriodAdditionConvention.adjust(LocalDate, Period, HolidayCalendar) to add the period.
Step two, use BusinessDayAdjustment.adjust(LocalDate, ReferenceData) to adjust the result of step one.
date - the date to adjustrefData - the reference data, used to find the holiday calendarpublic DateAdjuster resolve(ReferenceData refData)
This returns a DateAdjuster that performs the same calculation as this adjustment.
It binds the holiday calendar, looked up from the reference data, into the result.
As such, there is no need to pass the reference data in again.
resolve in interface Resolvable<DateAdjuster>refData - the reference data, used to find the holiday calendarpublic String toString()
public static TenorAdjustment.Meta meta()
TenorAdjustment.public static TenorAdjustment.Builder builder()
public TenorAdjustment.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic Tenor getTenor()
When the adjustment is performed, this tenor will be added to the input date.
public PeriodAdditionConvention getAdditionConvention()
When the adjustment is performed, this convention is used to refine the adjusted date. The most common convention is to move the end date to the last business day of the month if the start date is the last business day of the month.
public BusinessDayAdjustment getAdjustment()
This adjustment is applied to the result of the addition calculation.
If no adjustment is required, use the 'None' business day adjustment.
public TenorAdjustment.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.