Package ninja.scheduler.cron
Class CronExpression
- java.lang.Object
-
- ninja.scheduler.cron.CronExpression
-
public class CronExpression extends Object
Represent a CRON expression.
-
-
Constructor Summary
Constructors Constructor Description CronExpression(String cron)
Build a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
getNextDelayMilliseconds(LocalDateTime from)
Retrieves the delay from given datetime to the next match.long
getNextDelayMilliseconds(ZoneId zoneId)
Retrieves the delay from now to the next match.
-
-
-
Constructor Detail
-
CronExpression
public CronExpression(String cron)
Build a new instance.- Parameters:
cron
- The CRON expression to parse
-
-
Method Detail
-
getNextDelayMilliseconds
public long getNextDelayMilliseconds(ZoneId zoneId)
Retrieves the delay from now to the next match.- Parameters:
zoneId
- The Zone to use for manipulating datetime- Returns:
- The next delay in milliseconds
-
getNextDelayMilliseconds
protected long getNextDelayMilliseconds(LocalDateTime from)
Retrieves the delay from given datetime to the next match.- Parameters:
from
- The datetime- Returns:
- The next delay in milliseconds
-
-