Class EmbeddedCronParser
- java.lang.Object
-
- org.apache.felix.hc.core.impl.scheduling.cron.embedded.EmbeddedCronParser
-
public final class EmbeddedCronParser extends Object
Used to parse cron expressions.The pattern comprises a list of six single space-separated fields: second, minute, hour, day, month, weekday.
Month and weekday names can be given as the first three letters of the English names.
Examples:- "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
- "@daily" = every day
- "@annually" = every year
- "@weekly" = every week
- "@hourly" = every hour
- "@monthly" = every month
-
-
Constructor Summary
Constructors Constructor Description EmbeddedCronParser(String expression)
Construct aEmbeddedCronParser
from the pattern provided, using the defaultTimeZone
.EmbeddedCronParser(String expression, TimeZone timeZone)
Construct aEmbeddedCronParser
from the pattern provided, using the specifiedTimeZone
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
int
hashCode()
long
next(long date)
Get the nextDate
in the sequence matching the Cron pattern and after the value provided.String
toString()
-
-
-
Constructor Detail
-
EmbeddedCronParser
public EmbeddedCronParser(String expression)
Construct aEmbeddedCronParser
from the pattern provided, using the defaultTimeZone
.- Parameters:
expression
- a space-separated list of time fields- Throws:
IllegalArgumentException
- if the pattern cannot be parsed- See Also:
TimeZone.getDefault()
-
EmbeddedCronParser
public EmbeddedCronParser(String expression, TimeZone timeZone)
Construct aEmbeddedCronParser
from the pattern provided, using the specifiedTimeZone
.- Parameters:
expression
- a space-separated list of time fieldstimeZone
- the TimeZone to use for generated trigger times- Throws:
IllegalArgumentException
- if the pattern cannot be parsed
-
-
Method Detail
-
next
public long next(long date)
Get the nextDate
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
-
-