public abstract class TriggerBuilder extends Object
TriggerBuilder is used to instantiate Triggers.
Quartz provides a builder-style API for constructing scheduling-related entities via a Domain-Specific Language (DSL). The DSL can best be utilized
through the usage of static imports of the methods on the classes TriggerBuilder, JobBuilder, DateBuilder,
JobKey, TriggerKey and the various ScheduleBuilder implementations.
Client code can then use the DSL to write code such as this:
JobDetail job = newJob(MyJob.class).withIdentity("myJob").build(); Trigger trigger =
newTrigger().withIdentity(triggerKey("myTrigger", "myTriggerGroup"))
.withSchedule(simpleSchedule().withIntervalInHours(1).repeatForever()).startAt(futureDate(10, MINUTES)).build(); scheduler.scheduleJob(job,
trigger);
| Constructor and Description |
|---|
TriggerBuilder() |
| Modifier and Type | Method and Description |
|---|---|
OperableTrigger |
build()
Produce the
OperableTrigger. |
TriggerBuilder |
endAt(Date endTime)
Set the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats.
|
TriggerBuilder |
forJob(String jobName)
Set the identity of the Job which should be fired by the produced Trigger.
|
abstract OperableTrigger |
instantiate() |
TriggerBuilder |
modifiedByCalendar(String calendarName)
Set the name of the
Calendar that should be applied to this Trigger's schedule. |
TriggerBuilder |
startAt(Date startTime)
Set the time the Trigger should start at - the trigger may or may not fire at this time - depending upon the schedule configured for the Trigger.
|
TriggerBuilder |
startNow()
Set the time the Trigger should start at to the current moment - the trigger may or may not fire at this time - depending upon the schedule
configured for the Trigger.
|
TriggerBuilder |
usingJobData(JobDataMap newJobDataMap)
Set the Trigger's
JobDataMap. |
TriggerBuilder |
withDescription(String description)
Set the given (human-meaningful) description of the Trigger.
|
TriggerBuilder |
withIdentity(String name)
Use the given TriggerKey to identify the Trigger.
|
TriggerBuilder |
withPriority(int priority)
Set the Trigger's priority.
|
TriggerBuilder |
withTriggerImplementation(OperableTrigger operableTrigger)
Set the
ScheduleBuilder that will be used to define the Trigger's schedule. |
public abstract OperableTrigger instantiate()
public OperableTrigger build()
OperableTrigger.public TriggerBuilder withIdentity(String name)
If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
name - the TriggerKey for the Trigger to be builtpublic TriggerBuilder withDescription(String description)
description - the description for the Triggerpublic TriggerBuilder withPriority(int priority)
priority - the priority for the Triggerpublic TriggerBuilder modifiedByCalendar(String calendarName)
Calendar that should be applied to this Trigger's schedule.calendarName - the name of the Calendar to reference.public TriggerBuilder startNow()
public TriggerBuilder startAt(Date startTime)
startTime - the start time for the Trigger.public TriggerBuilder endAt(Date endTime)
endTime - the end time for the Trigger. If null, the end time is indefinite.public TriggerBuilder withTriggerImplementation(OperableTrigger operableTrigger)
ScheduleBuilder that will be used to define the Trigger's schedule.
The particular SchedulerBuilder used will dictate the concrete type of Trigger that is produced by the TriggerBuilder.
scheduleBuilder - the SchedulerBuilder to use.public TriggerBuilder forJob(String jobName)
jobName - the identity of the Job to fire.public TriggerBuilder usingJobData(JobDataMap newJobDataMap)
JobDataMap.Copyright © 2011–2017 Knowm Inc.. All rights reserved.