Class TenorAdjustment

  • All Implemented Interfaces:
    Resolvable<DateAdjuster>, Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class TenorAdjustment
    extends Object
    implements Resolvable<DateAdjuster>, org.joda.beans.ImmutableBean, Serializable
    An adjustment that alters a date by adding a tenor.

    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".

    See Also:
    Serialized Form
    • Method Detail

      • of

        public static TenorAdjustment of​(Tenor tenor,
                                         PeriodAdditionConvention additionConvention,
                                         BusinessDayAdjustment adjustment)
        Obtains an instance that can adjust a date by the specified tenor.

        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.

        Parameters:
        tenor - the tenor to add to the input date
        additionConvention - the convention used to perform the addition
        adjustment - the business day adjustment to apply to the result of the addition
        Returns:
        the tenor adjustment
      • ofLastDay

        public 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.

        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.

        Parameters:
        tenor - the tenor to add to the input date
        adjustment - the business day adjustment to apply to the result of the addition
        Returns:
        the tenor adjustment
      • ofLastBusinessDay

        public 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.

        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.

        Parameters:
        tenor - the tenor to add to the input date
        adjustment - the business day adjustment to apply to the result of the addition
        Returns:
        the tenor adjustment
      • resolve

        public DateAdjuster resolve​(ReferenceData refData)
        Resolves this adjustment using the specified reference data, returning an adjuster.

        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.

        Specified by:
        resolve in interface Resolvable<DateAdjuster>
        Parameters:
        refData - the reference data, used to find the holiday calendar
        Returns:
        the adjuster, bound to a specific holiday calendar
      • toString

        public String toString()
        Returns a string describing the adjustment.
        Overrides:
        toString in class Object
        Returns:
        the descriptive string
      • meta

        public static TenorAdjustment.Meta meta()
        The meta-bean for TenorAdjustment.
        Returns:
        the meta-bean, not null
      • builder

        public static TenorAdjustment.Builder builder()
        Returns a builder used to create an instance of the bean.
        Returns:
        the builder, not null
      • metaBean

        public TenorAdjustment.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getTenor

        public Tenor getTenor()
        Gets the tenor to be added.

        When the adjustment is performed, this tenor will be added to the input date.

        Returns:
        the value of the property, not null
      • getAdditionConvention

        public PeriodAdditionConvention getAdditionConvention()
        Gets the addition convention to apply.

        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.

        Returns:
        the value of the property, not null
      • getAdjustment

        public BusinessDayAdjustment getAdjustment()
        Gets the business day adjustment that is performed to the result of the addition.

        This adjustment is applied to the result of the addition calculation.

        If no adjustment is required, use the 'None' business day adjustment.

        Returns:
        the value of the property, not null
      • toBuilder

        public TenorAdjustment.Builder toBuilder()
        Returns a builder that allows this bean to be mutated.
        Returns:
        the mutable builder, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object