Attributes
Members list
Type members
Inherited types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
Parse a string as a schedule.
Parse a string as a schedule.
The syntax is similar to that of systemd calendar specifications (man systemd.time
).
E.g. Mon..Fri *-5/2-1 *:20,34:00
meaning:
- from monday to friday (inclusive), and
- any year, and
- from may and every second month thereafter, and
- any hour, and
- minute 20 and 34, and
- second 0
The schedule is parsed in three space-separated parts:
- a day-of-week filter
- a date filter
- a time filter
At least one of the of the parts must be specified, and they must be specified in order.
If a part is omitted, the following filters are assumed:
- day-of-week part => any
- date part => any
- time part => 00:00:00
In other words, if the day-of-week part is omitted, any day of week is valid, if the date part is omitted then any date is valid, and if the time part is omitted then only midnight is valid.
In the date filter, if no year is specified, then any year matched. I.e.
10-2
is equivalent to *-10-2
In the time filter, if no second is specified, then second 0 is matched.
I.e. 20:30
is equivalent to 20:30:00
A filter may be either *
, or a disjunction of numbers or a range. *
is
the wildcard filter which matches anything. A disjunction is separated by
,
and any of the numbers or ranges must match for the schedule to
happen. A range is given as start[..step][/step]
(inclusive).
Examples
Example | Expanded | Explanation |
---|---|---|
Mon..Fri | Mon..Fri *-*-* 00:00:00 | Every monday to friday at midnight |
10-2 | Mon..Sun *-10-2 00:00:00 | Every 10th October to friday at midnight |
2023-10-28 | Mon..Sun 2023-10-2 00:00:00 | On 2023-10-2 at midnight (this happens only once) |
20:30 | Mon..Sun *-*-* 20:30:00 | Every day at 20:30 |
20:30:15 | Mon..Sun *-*-* 20:30:15 | Every day at 20:30:15 |
*-*-1/2 | Mon..Sun *-*-1/2 00:00:00 | On the first day of the month and every second day after (1st, 3rd, 5th etc...) |
Tue *-*-1 | Tue *-*-1 00:00:00 | On the first day of the month, but only if it's a Tuesday |
*:20,40 | Mon..Sun *-*-* *:20:40 | At twenty past and forty past every hour. |
Specification in extended BNF
schedule ::= [dayofweekspec] [datespec] [timespec]
dayofweekspec ::= dayofweekrange{,dayofweekrange}
dayofweekrange ::= dayofweek[..dayofweek]
dayofweek ::= 'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat' | 'Sun'
datespec ::= comps-comps | comps-comps-comps // either month-day or year-month-day
timespec ::= comps:comps | comps:comps:comps // either hour:minute of hour:minute:second
comps ::= comp{,comp}
comp ::= '*' | filter
filter ::= int[..int][/int]
Attributes
- Throws:
- IllegalArgumentException
if the specification was invalid