Interface BusinessDayConvention

  • All Superinterfaces:
    Named

    public interface BusinessDayConvention
    extends Named
    A convention defining how to adjust a date if it falls on a day other than a business day.

    The purpose of this convention is to define how to handle non-business days. 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. The convention, in conjunction with a holiday calendar, defines exactly how the adjustment should be made.

    The most common implementations are provided in BusinessDayConventions. Additional implementations may be added by implementing this interface.

    All implementations of this interface must be immutable and thread-safe.

    • Method Detail

      • of

        static BusinessDayConvention of​(java.lang.String uniqueName)
        Obtains an instance from the specified unique name.
        Parameters:
        uniqueName - the unique name
        Returns:
        the business convention
        Throws:
        java.lang.IllegalArgumentException - if the name is not known
      • extendedEnum

        static ExtendedEnum<BusinessDayConvention> extendedEnum()
        Gets the extended enum helper.

        This helper allows instances of the convention to be looked up. It also provides the complete set of available instances.

        Returns:
        the extended enum helper
      • adjust

        java.time.LocalDate adjust​(java.time.LocalDate date,
                                   HolidayCalendar calendar)
        Adjusts the date as necessary if it is not a business day.

        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.

        Parameters:
        date - the date to adjust
        calendar - the calendar that defines holidays and business days
        Returns:
        the adjusted date
      • getName

        java.lang.String getName()
        Gets the name that uniquely identifies this convention.

        This name is used in serialization and can be parsed using of(String).

        Specified by:
        getName in interface Named
        Returns:
        the unique name