Class DateAdjusters.RelativeDayOfWeek

  • All Implemented Interfaces:
    java.io.Serializable, DateAdjuster
    Enclosing class:
    DateAdjusters

    private static final class DateAdjusters.RelativeDayOfWeek
    extends java.lang.Object
    implements DateAdjuster, java.io.Serializable
    Implementation of next, previous or current day-of-week.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private DayOfWeek dow
      The day-of-week to find.
      private int relative
      Whether the current date is a valid answer.
      private static long serialVersionUID
      A serialization identifier for this class.
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        A serialization identifier for this class.
        See Also:
        Constant Field Values
      • relative

        private final int relative
        Whether the current date is a valid answer.
      • dow

        private final DayOfWeek dow
        The day-of-week to find.
    • Constructor Detail

      • RelativeDayOfWeek

        private RelativeDayOfWeek​(int relative,
                                  DayOfWeek dow)
    • Method Detail

      • adjustDate

        public LocalDate adjustDate​(LocalDate date)
        Adjusts the input date returning the adjusted date.

        This is a strategy pattern that allows a range of adjustments to be made to a date.

        Specified by:
        adjustDate in interface DateAdjuster
        Parameters:
        date - the date to adjust, not null
        Returns:
        the adjusted date, never null
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object