CronScheduledTrigger
A trigger that triggers based on a cron job specification.
Based on the cron package. See crontab guru for a useful tool for specifying cron jobs.
- Inheritance
-
- Object
- Serializable
- TriggerConfiguration
- CronScheduledTrigger
- Implemented types
- Annotations
-
- @JsonSerializable(includeIfNull: false, explicitToJson: true)
Constructors
CronScheduledTrigger.fromJson
CronScheduledTrigger
Creates a cron scheduled trigger based on specifying:
minute- The minute to trigger.int0-59ornull(= match all).hour- The hour to trigger.int0-23ornull(= match all).day- The day of the month to trigger.int1-31ornull(= match all).month- The month to trigger.int1-12ornull(= match all).weekday- The week day to trigger.int0-6ornull(= match all).
CronScheduledTrigger.parse
Creates a CronScheduledTrigger based on a cron-formatted string expression.
cronExpression- The cron expression as aString.duration- Not used.
Cron format used is:
<minutes> <hours> <days> <months> <weekdays>
For example:
42 19 * * *is "Everyday at 19:42".0 9 * * 1is "Every Monday at 09:00".0 0 1 * *is "The first day of every month at midnight".
Note the following:
- the fields are separated by spaces
- that
*is used to signify "match all" - that the weekday field uses
0for Sunday - that the number fields are numbered from
0(minutes, weekdays) or1(hours, days, months) - that numbers are single values - ranges and lists are not supported
- that number are to be stated as integers, and not a string with leading zeros (e.g., use
9and not09for 9 o'clock)
See e.g. crontab guru for help in formatting cron jobs.
Properties
cronExpression
The cron expression, in the format <minutes> <hours> <days> <months> <weekdays>.
fromJsonFunction
The function which can convert a JSON string to an object of this type.
Methods
toJson
Return a JSON encoding of this object.
toString
A string representation of this object.
Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.
Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.