Interface DateAdjuster

  • All Superinterfaces:
    java.time.temporal.TemporalAdjuster
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface DateAdjuster
    extends java.time.temporal.TemporalAdjuster
    Functional interface that can adjust a date.

    This extends TemporalAdjuster for those cases where the temporal to be adjusted is an ISO-8601 date.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.time.LocalDate adjust​(java.time.LocalDate date)
      Adjusts the date according to the rules of the implementation.
      default java.time.temporal.Temporal adjustInto​(java.time.temporal.Temporal temporal)
      Adjusts the temporal according to the rules of the implementation.
    • Method Detail

      • adjust

        java.time.LocalDate adjust​(java.time.LocalDate date)
        Adjusts the date according to the rules of the implementation.

        Implementations must specify how the date is adjusted.

        Parameters:
        date - the date to adjust
        Returns:
        the adjusted date
        Throws:
        java.time.DateTimeException - if unable to make the adjustment
        java.lang.ArithmeticException - if numeric overflow occurs
      • adjustInto

        default java.time.temporal.Temporal adjustInto​(java.time.temporal.Temporal temporal)
        Adjusts the temporal according to the rules of the implementation.

        This method implements TemporalAdjuster by calling adjust(LocalDate). Note that conversion to LocalDate ignores the calendar system of the input, which is the desired behaviour in this case.

        Specified by:
        adjustInto in interface java.time.temporal.TemporalAdjuster
        Parameters:
        temporal - the temporal to adjust
        Returns:
        the adjusted temporal
        Throws:
        java.time.DateTimeException - if unable to make the adjustment
        java.lang.ArithmeticException - if numeric overflow occurs