CronTrigger Class

public final class CronTrigger
extends TriggerBase

The CronTrigger model.

Constructor Summary

Constructor Description
CronTrigger()

Creates an instance of CronTrigger class.

Method Summary

Modifier and Type Method and Description
String expression()

Get the expression property: [Required] Specifies cron expression of schedule.

static CronTrigger fromJson(JsonReader jsonReader)

Reads an instance of CronTrigger from the JsonReader.

JsonWriter toJson(JsonWriter jsonWriter)
TriggerType triggerType()

Get the triggerType property: [Required].

void validate()

Validates the instance.

CronTrigger withEndTime(String endTime)

Set the endTime property: Specifies end time of schedule in ISO 8601, but without a UTC offset.

CronTrigger withExpression(String expression)

Set the expression property: [Required] Specifies cron expression of schedule.

CronTrigger withStartTime(String startTime)

Set the startTime property: Specifies start time of schedule in ISO 8601 format, but without a UTC offset.

CronTrigger withTimeZone(String timeZone)

Set the timeZone property: Specifies time zone in which the schedule runs.

Methods inherited from TriggerBase

Methods inherited from java.lang.Object

Constructor Details

CronTrigger

public CronTrigger()

Creates an instance of CronTrigger class.

Method Details

expression

public String expression()

Get the expression property: [Required] Specifies cron expression of schedule. The expression should follow NCronTab format.

Returns:

the expression value.

fromJson

public static CronTrigger fromJson(JsonReader jsonReader)

Reads an instance of CronTrigger from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of CronTrigger if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

CronTrigger.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

triggerType

public TriggerType triggerType()

Get the triggerType property: [Required].

Overrides:

CronTrigger.triggerType()

Returns:

the triggerType value.

validate

public void validate()

Validates the instance.

Overrides:

CronTrigger.validate()

withEndTime

public CronTrigger withEndTime(String endTime)

Set the endTime property: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer https://en.wikipedia.org/wiki/ISO\_8601. Recommented format would be "2022-06-01T00:00:01" If not present, the schedule will run indefinitely.

Overrides:

CronTrigger.withEndTime(String endTime)

Parameters:

endTime

withExpression

public CronTrigger withExpression(String expression)

Set the expression property: [Required] Specifies cron expression of schedule. The expression should follow NCronTab format.

Parameters:

expression - the expression value to set.

Returns:

the CronTrigger object itself.

withStartTime

public CronTrigger withStartTime(String startTime)

Set the startTime property: Specifies start time of schedule in ISO 8601 format, but without a UTC offset.

Overrides:

CronTrigger.withStartTime(String startTime)

Parameters:

startTime

withTimeZone

public CronTrigger withTimeZone(String timeZone)

Set the timeZone property: Specifies time zone in which the schedule runs. TimeZone should follow Windows time zone format. Refer: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11.

Overrides:

CronTrigger.withTimeZone(String timeZone)

Parameters:

timeZone

Applies to