org.springframework.scheduling.support
Class CronSequenceGenerator

java.lang.Object
  extended by org.springframework.scheduling.support.CronSequenceGenerator

public class CronSequenceGenerator
extends Object

Date sequence generator for a Crontab pattern, allowing clients to specify a pattern that the sequence matches.

The pattern is a list of six 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:

Since:
3.0
Author:
Dave Syer, Juergen Hoeller
See Also:
CronTrigger

Constructor Summary
CronSequenceGenerator(String expression, TimeZone timeZone)
          Construct a CronSequenceGenerator from the pattern provided.
 
Method Summary
 boolean equals(Object obj)
           
 int hashCode()
           
 Date next(Date date)
          Get the next Date in the sequence matching the Cron pattern and after the value provided.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CronSequenceGenerator

public CronSequenceGenerator(String expression,
                             TimeZone timeZone)
Construct a CronSequenceGenerator from the pattern provided.

Parameters:
expression - a space-separated list of time fields
timeZone - the TimeZone to use for generated trigger times
Throws:
IllegalArgumentException - if the pattern cannot be parsed
Method Detail

next

public Date next(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(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object