Class Interval

java.lang.Object
org.jobrunr.scheduling.Schedule
org.jobrunr.scheduling.interval.Interval
All Implemented Interfaces:
Comparable<Schedule>

public class Interval extends Schedule
  • Constructor Details

    • Interval

      public Interval(Duration duration)
    • Interval

      public Interval(String durationExpression)
  • Method Details

    • next

      public Instant next(Instant createdAtInstant, Instant currentInstant, ZoneId zoneId)
      Description copied from class: Schedule
      Calculates the next occurrence based on the creation time and the provided base time.
      Specified by:
      next in class Schedule
      Parameters:
      createdAtInstant - Instant object when the schedule was first created
      currentInstant - Instant object used to calculate next occurrence (normally Instant.now()).
      zoneId - the zone for which to calculate the schedule
      Returns:
      Instant of the next occurrence.
    • validateSchedule

      public void validateSchedule()
      Specified by:
      validateSchedule in class Schedule
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Compares this object against the specified object. The result is true if and only if the argument is not null and is a Schedule object that whose seconds, minutes, hours, days, months, and days of weeks sets are equal to those of this schedule.

      The expression string used to create the schedule is not considered, as two different expressions may produce same schedules.

      Overrides:
      equals in class Schedule
      Parameters:
      obj - the object to compare with
      Returns:
      true if the objects are the same; false otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Schedule