Interface PeriodAdditionConvention

  • All Superinterfaces:
    Named

    public interface PeriodAdditionConvention
    extends Named
    A convention defining how a period is added to a date.

    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.

    • Method Detail

      • extendedEnum

        static ExtendedEnum<PeriodAdditionConvention> 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

        LocalDate adjust​(LocalDate baseDate,
                         Period period,
                         HolidayCalendar calendar)
        Adjusts the base date, adding the period and applying the convention rule.

        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.

        Parameters:
        baseDate - the base date to add to
        period - the period to add
        calendar - the holiday calendar to use
        Returns:
        the adjusted date
      • isMonthBased

        boolean isMonthBased()
        Checks whether the convention requires a month-based period.

        A month-based period contains only months and/or years, and not days.

        Returns:
        true if the convention requires a month-based period
      • getName

        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