Class ShiftedQuarter

java.lang.Object
org.springframework.modulith.moments.ShiftedQuarter

public class ShiftedQuarter extends Object
A quarter that can be shifted to start at a configurable Month.
Author:
Oliver Drotbohm
  • Method Details

    • of

      public static ShiftedQuarter of(Quarter quarter, Month startMonth)
      Creates a new ShiftedQuarter for the given Quarter and start Month.
      Parameters:
      quarter - must not be null.
      startMonth - must not be null.
    • of

      public static ShiftedQuarter of(Quarter quarter)
    • getQuarter

      public Quarter getQuarter()
      Returns the logical Quarter.
      Returns:
      will never be null.
    • next

      public ShiftedQuarter next()
      Returns the next ShiftedQuarter.
      Returns:
      will never be null.
    • contains

      public boolean contains(LocalDate date)
      Returns whether the given LocalDate is contained in the current ShiftedQuarter.
      Parameters:
      date - must not be null.
      Returns:
    • getStart

      public MonthDay getStart()
      Returns:
      will never be null.
    • getEnd

      public MonthDay getEnd()
      Returns:
      will never be null.
    • isLastDay

      public boolean isLastDay(LocalDate date)
      Returns whether the given LocalDate is the last day of the ShiftedQuarter.
      Parameters:
      date - must not be null.
    • getStartDate

      public LocalDate getStartDate(Year year)
      Returns the start date of the ShiftedQuarter for the given Year.
      Parameters:
      year - must not be null.
      Returns:
      will never be null.
    • getEndDate

      public LocalDate getEndDate(Year year)
      Returns the end date of the ShiftedQuarter for the given Year.
      Parameters:
      year - must not be null.
      Returns:
      will never be null.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object