Class Interval
- java.lang.Object
-
- cn.boboweike.carrot.scheduling.Schedule
-
- cn.boboweike.carrot.scheduling.interval.Interval
-
- All Implemented Interfaces:
Comparable<Schedule>
public class Interval extends Schedule
-
-
Field Summary
-
Fields inherited from class cn.boboweike.carrot.scheduling.Schedule
SMALLEST_SCHEDULE_IN_SECONDS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)Compares this object against the specified object.inthashCode()Instantnext(Instant createdAtInstant, Instant currentInstant, ZoneId zoneId)Calculates the next occurrence based on the creation time and the provided base time.StringtoString()voidvalidateSchedule()
-
-
-
Method Detail
-
next
public Instant next(Instant createdAtInstant, Instant currentInstant, ZoneId zoneId)
Description copied from class:ScheduleCalculates the next occurrence based on the creation time and the provided base time.- Specified by:
nextin classSchedule- Parameters:
createdAtInstant- Instant object when the schedule was first createdcurrentInstant- 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:
validateSchedulein classSchedule
-
equals
public boolean equals(Object obj)
Compares this object against the specified object. The result istrueif and only if the argument is notnulland is aScheduleobject 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.
-
-