public final class BusinessDayAdjustment extends Object implements Resolvable<DateAdjuster>, org.joda.beans.ImmutableBean, Serializable
When processing dates in finance, it is typically intended that non-business days, such as weekends and holidays, are converted to a nearby valid business day. This class represents the necessary adjustment.
This class combines a business day convention
with a holiday calendar. To adjust a date,
ReferenceData must be provided to resolve the holiday calendar.
| Modifier and Type | Class and Description |
|---|---|
static class |
BusinessDayAdjustment.Builder
The bean-builder for
BusinessDayAdjustment. |
static class |
BusinessDayAdjustment.Meta
The meta-bean for
BusinessDayAdjustment. |
| Modifier and Type | Field and Description |
|---|---|
static BusinessDayAdjustment |
NONE
An instance that performs no adjustment.
|
| Modifier and Type | Method and Description |
|---|---|
LocalDate |
adjust(LocalDate date,
ReferenceData refData)
Adjusts the date as necessary if it is not a business day.
|
static BusinessDayAdjustment.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
boolean |
equals(Object obj) |
HolidayCalendarId |
getCalendar()
Gets the calendar that defines holidays and business days.
|
BusinessDayConvention |
getConvention()
Gets the convention used to the adjust the date if it does not fall on a business day.
|
int |
hashCode() |
static BusinessDayAdjustment.Meta |
meta()
The meta-bean for
BusinessDayAdjustment. |
BusinessDayAdjustment.Meta |
metaBean() |
static BusinessDayAdjustment |
of(BusinessDayConvention convention,
HolidayCalendarId calendar)
Obtains an instance using the specified convention and calendar.
|
DateAdjuster |
resolve(ReferenceData refData)
Resolves this adjustment using the specified reference data, returning an adjuster.
|
BusinessDayAdjustment.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString()
Returns a string describing the adjustment.
|
public static final BusinessDayAdjustment NONE
public static BusinessDayAdjustment of(BusinessDayConvention convention, HolidayCalendarId calendar)
When adjusting a date, the convention rule will be applied using the specified calendar.
convention - the convention used to the adjust the date if it does not fall on a business daycalendar - the calendar that defines holidays and business dayspublic LocalDate adjust(LocalDate date, ReferenceData refData)
If the date is a business day it will be returned unaltered. If the date is not a business day, the convention will be applied.
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 BusinessDayAdjustment.Meta meta()
BusinessDayAdjustment.public static BusinessDayAdjustment.Builder builder()
public BusinessDayAdjustment.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic BusinessDayConvention getConvention()
The convention determines whether to move forwards or backwards when it is a holiday.
public HolidayCalendarId getCalendar()
When the adjustment is made, this calendar is used to skip holidays.
public BusinessDayAdjustment.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.