org.springframework.integration.scheduling
Class CronSequenceGenerator
java.lang.Object
org.springframework.integration.scheduling.CronSequenceGenerator
public class CronSequenceGenerator
- extends java.lang.Object
Date sequence generator for a Crontab pattern allowing
client to specify a pattern that the sequence matches. The pattern is a list
of 6 single space separated fields representing (second, minute, hour, day,
month, weekday). Month and weekday names can be given as the first three
letters of the English names.
Example patterns
- "0 0 * * * *" = the top of every hour of every day.
- "*/10 * * * * *" = every ten seconds.
- "0 0 8-10 * * *" = 8, 9 and 10 o'clock of every day.
- "0 0 8-10/30 * * *" = 8:00, 8:30, 9:00, 9:30 and 10 o'clock every day.
- "0 0 9-17 * * MON-FRI" = on the hour nine-to-five weekdays
- "0 0 0 25 12 ?" = every Christmas Day at midnight
- Author:
- Dave Syer
Method Summary |
boolean |
equals(java.lang.Object obj)
|
int |
hashCode()
|
java.util.Date |
next(java.util.Date date)
Get the next Date in the sequence matching the Cron pattern and
after the value provided. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
CronSequenceGenerator
public CronSequenceGenerator(java.lang.String pattern)
throws java.lang.IllegalArgumentException
- Construct a
CronSequenceGenerator
from the pattern provided.
- Parameters:
pattern
- a space separated list of time fields
- Throws:
java.lang.IllegalArgumentException
- if the pattern cannot be parsed
next
public java.util.Date next(java.util.Date date)
- Get the next
Date
in the sequence matching the Cron pattern and
after the value provided. The return value will have a whole number of
seconds, and will be after the input value.
- Parameters:
date
- a seed value
- Returns:
- the next value matching the pattern
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in class java.lang.Object
- See Also:
Object.equals(Object)
hashCode
public int hashCode()
- Overrides:
hashCode
in class java.lang.Object
- See Also:
Object.hashCode()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object