public class

CronSequenceGenerator

extends Object
java.lang.Object
   ↳ org.springframework.scheduling.support.CronSequenceGenerator

Class Overview

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:

  • "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/30 8-10 * * *" = 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

See Also

Summary

Public Constructors
CronSequenceGenerator(String expression, TimeZone timeZone)
Construct a CronSequenceGenerator from the pattern provided.
Public Methods
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()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

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

Public Methods

public boolean equals (Object obj)

public int hashCode ()

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

public String toString ()