Class RelativeDuration

java.lang.Object
energy.eddie.dataneeds.duration.DataNeedDuration
energy.eddie.dataneeds.duration.RelativeDuration

@Entity public class RelativeDuration extends DataNeedDuration
  • Field Details

  • Constructor Details

    • RelativeDuration

      protected RelativeDuration()
    • RelativeDuration

      public RelativeDuration(@Nullable Period start, @Nullable Period end, @Nullable CalendarUnit stickyStartCalendarUnit)
  • Method Details

    • start

      public Optional<Period> start()
      Returns the period that should be used as offset for the start. If empty, assume the earliest date that the region connector supports.
    • end

      public Optional<Period> end()
      Returns the period that should be used as offset for the end. If empty, assume the latest date that the region connector supports.
    • stickyStartCalendarUnit

      public Optional<CalendarUnit> stickyStartCalendarUnit()
      Indicates the CalendarUnit to which the start of the relative duration should stick to.
      E.g., assume today is the 17.04., the relative start is -25 days and stickyStartCalendarUnit() is CalendarUnit.MONTH, then, for a permission request that is created today, the start date should not be 23.03, but it should stick to the start of the CalendarUnit, and therefore be 01.03. Furthermore, for a permission request that is created on the 26.04, the start date should be 01.04 and so forth.
      For the CalendarUnit.WEEK it should stick to Mondays.
      Returns:
      CalendarUnit to stick to, if empty it should be ignored.