|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.TriggerBuilder<T>
public class TriggerBuilder<T extends Trigger>
TriggerBuilder
is used to instantiate Trigger
s.
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);
JobBuilder
,
ScheduleBuilder
,
DateBuilder
,
Trigger
Method Summary | ||
---|---|---|
T |
build()
Produce the Trigger . |
|
TriggerBuilder<T> |
endAt(java.util.Date endTime)
Set the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats. |
|
TriggerBuilder<T> |
forJob(JobDetail jobDetail)
Set the identity of the Job which should be fired by the produced Trigger, by extracting the JobKey from the given job. |
|
TriggerBuilder<T> |
forJob(JobKey jobKey)
Set the identity of the Job which should be fired by the produced Trigger. |
|
TriggerBuilder<T> |
forJob(java.lang.String jobName)
Set the identity of the Job which should be fired by the produced Trigger - a JobKey will be produced with the given
name and default group. |
|
TriggerBuilder<T> |
forJob(java.lang.String jobName,
java.lang.String jobGroup)
Set the identity of the Job which should be fired by the produced Trigger - a JobKey will be produced with the given
name and group. |
|
TriggerBuilder<T> |
modifiedByCalendar(java.lang.String calendarName)
Set the name of the Calendar that should be applied to this
Trigger's schedule. |
|
static TriggerBuilder<Trigger> |
newTrigger()
Create a new TriggerBuilder with which to define a specification for a Trigger. |
|
TriggerBuilder<T> |
startAt(java.util.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<T> |
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<T> |
usingJobData(JobDataMap newJobDataMap)
Set the Trigger's JobDataMap , adding any values to it
that were already set on this TriggerBuilder using any of the
other 'usingJobData' methods. |
|
TriggerBuilder<T> |
usingJobData(java.lang.String key,
java.lang.Boolean value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(java.lang.String key,
java.lang.Double value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(java.lang.String key,
java.lang.Float value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(java.lang.String key,
java.lang.Integer value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(java.lang.String key,
java.lang.Long value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
usingJobData(java.lang.String key,
java.lang.String value)
Add the given key-value pair to the Trigger's JobDataMap . |
|
TriggerBuilder<T> |
withDescription(java.lang.String description)
Set the given (human-meaningful) description of the Trigger. |
|
TriggerBuilder<T> |
withIdentity(java.lang.String name)
Use a TriggerKey with the given name and default group to
identify the Trigger. |
|
TriggerBuilder<T> |
withIdentity(java.lang.String name,
java.lang.String group)
Use a TriggerKey with the given name and group to identify the Trigger. |
|
TriggerBuilder<T> |
withIdentity(TriggerKey key)
Use the given TriggerKey to identify the Trigger. |
|
TriggerBuilder<T> |
withPriority(int priority)
Set the Trigger's priority. |
|
|
withSchedule(ScheduleBuilder<SBT> scheduleBuilder)
Set the ScheduleBuilder that will be used to define the
Trigger's schedule. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static TriggerBuilder<Trigger> newTrigger()
public T build()
Trigger
.
public TriggerBuilder<T> withIdentity(java.lang.String name)
TriggerKey
with the given name and default group to
identify the Trigger.
If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
name
- the name element for the Trigger's TriggerKey
TriggerKey
,
Trigger.getKey()
public TriggerBuilder<T> withIdentity(java.lang.String name, java.lang.String group)
If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
name
- the name element for the Trigger's TriggerKeygroup
- the group element for the Trigger's TriggerKey
TriggerKey
,
Trigger.getKey()
public TriggerBuilder<T> withIdentity(TriggerKey key)
If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
key
- the TriggerKey for the Trigger to be built
TriggerKey
,
Trigger.getKey()
public TriggerBuilder<T> withDescription(java.lang.String description)
description
- the description for the Trigger
Trigger.getDescription()
public TriggerBuilder<T> withPriority(int priority)
priority
- the priority for the Trigger
Trigger.DEFAULT_PRIORITY
,
Trigger.getPriority()
public TriggerBuilder<T> modifiedByCalendar(java.lang.String calendarName)
Calendar
that should be applied to this
Trigger's schedule.
calendarName
- the name of the Calendar to reference.
Calendar
,
Trigger.getCalendarName()
public TriggerBuilder<T> startAt(java.util.Date startTime)
startTime
- the start time for the Trigger.
Trigger.getStartTime()
,
DateBuilder
public TriggerBuilder<T> startNow()
Trigger.getStartTime()
public TriggerBuilder<T> endAt(java.util.Date endTime)
endTime
- the end time for the Trigger. If null, the end time is indefinite.
Trigger.getEndTime()
,
DateBuilder
public <SBT extends T> TriggerBuilder<SBT> withSchedule(ScheduleBuilder<SBT> scheduleBuilder)
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.
ScheduleBuilder
,
SimpleScheduleBuilder
,
CronScheduleBuilder
,
CalendarIntervalScheduleBuilder
public TriggerBuilder<T> forJob(JobKey jobKey)
jobKey
- the identity of the Job to fire.
Trigger.getJobKey()
public TriggerBuilder<T> forJob(java.lang.String jobName)
JobKey
will be produced with the given
name and default group.
jobName
- the name of the job (in default group) to fire.
Trigger.getJobKey()
public TriggerBuilder<T> forJob(java.lang.String jobName, java.lang.String jobGroup)
JobKey
will be produced with the given
name and group.
jobName
- the name of the job to fire.jobGroup
- the group of the job to fire.
Trigger.getJobKey()
public TriggerBuilder<T> forJob(JobDetail jobDetail)
jobDetail
- the Job to fire.
Trigger.getJobKey()
public TriggerBuilder<T> usingJobData(java.lang.String key, java.lang.String value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(java.lang.String key, java.lang.Integer value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(java.lang.String key, java.lang.Long value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(java.lang.String key, java.lang.Float value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(java.lang.String key, java.lang.Double value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(java.lang.String key, java.lang.Boolean value)
JobDataMap
.
Trigger.getJobDataMap()
public TriggerBuilder<T> usingJobData(JobDataMap newJobDataMap)
JobDataMap
, adding any values to it
that were already set on this TriggerBuilder using any of the
other 'usingJobData' methods.
Trigger.getJobDataMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |