public class DailyTimeIntervalScheduleBuilder extends Object implements IScheduleBuilder<DailyTimeIntervalTrigger>
IScheduleBuilder implementation that build schedule for
DailyTimeIntervalTrigger.
This builder provide an extra convenient method for you to set the trigger's endTimeOfDay. You may use either endingDailyAt() or endingDailyAfterCount() to set the value. The later will auto calculate your endTimeOfDay by using the interval, intervalUnit and startTimeOfDay to perform the calculation.
When using endingDailyAfterCount(), you should note that it is used to calculating endTimeOfDay. So if your startTime on the first day is already pass by a time that would not add up to the count you expected, until the next day comes. Remember that DailyTimeIntervalTrigger will use startTimeOfDay and endTimeOfDay as fresh per each day!
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 (onDaysOfTheWeek (MONDAY, THURSDAY))
.startAt (futureDate (10, MINUTES))
.build ();
scheduler.scheduleJob (job, trigger);
| Modifier | Constructor and Description |
|---|---|
protected |
DailyTimeIntervalScheduleBuilder() |
| Modifier and Type | Method and Description |
|---|---|
DailyTimeIntervalTrigger |
build()
Build the actual Trigger -- NOT intended to be invoked by end users, but
will rather be invoked by a TriggerBuilder which this ScheduleBuilder is
given to.
|
static DailyTimeIntervalScheduleBuilder |
dailyTimeIntervalSchedule()
Create a DailyTimeIntervalScheduleBuilder.
|
DailyTimeIntervalScheduleBuilder |
endingDailyAfterCount(int count)
Calculate and set the endTimeOfDay using count, interval and starTimeOfDay.
|
DailyTimeIntervalScheduleBuilder |
endingDailyAt(LocalTime timeOfDay)
Set the startTimeOfDay for this trigger to end firing each day at the given
time.
|
DailyTimeIntervalScheduleBuilder |
onDaysOfTheWeek(DayOfWeek... onDaysOfWeek)
Set the trigger to fire on the given days of the week.
|
DailyTimeIntervalScheduleBuilder |
onDaysOfTheWeek(Set<DayOfWeek> onDaysOfWeek)
Set the trigger to fire on the given days of the week.
|
DailyTimeIntervalScheduleBuilder |
onEveryDay()
Set the trigger to fire on all days of the week.
|
DailyTimeIntervalScheduleBuilder |
onMondayThroughFriday()
Set the trigger to fire on the days from Monday through Friday.
|
DailyTimeIntervalScheduleBuilder |
onSaturdayAndSunday()
Set the trigger to fire on the days Saturday and Sunday.
|
DailyTimeIntervalScheduleBuilder |
startingDailyAt(LocalTime timeOfDay)
Set the trigger to begin firing each day at the given time.
|
DailyTimeIntervalScheduleBuilder |
withInterval(int timeInterval,
EIntervalUnit unit)
Specify the time unit and interval for the Trigger to be produced.
|
DailyTimeIntervalScheduleBuilder |
withIntervalInHours(int intervalInHours)
Specify an interval in the IntervalUnit.HOUR that the produced Trigger will
repeat at.
|
DailyTimeIntervalScheduleBuilder |
withIntervalInMinutes(int intervalInMinutes)
Specify an interval in the IntervalUnit.MINUTE that the produced Trigger
will repeat at.
|
DailyTimeIntervalScheduleBuilder |
withIntervalInSeconds(int intervalInSeconds)
Specify an interval in the IntervalUnit.SECOND that the produced Trigger
will repeat at.
|
DailyTimeIntervalScheduleBuilder |
withMisfireHandlingInstructionDoNothing()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_DO_NOTHING instruction. |
DailyTimeIntervalScheduleBuilder |
withMisfireHandlingInstructionFireAndProceed()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction. |
DailyTimeIntervalScheduleBuilder |
withMisfireHandlingInstructionIgnoreMisfires()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
instruction. |
DailyTimeIntervalScheduleBuilder |
withRepeatCount(int nRepeatCount)
Set number of times for interval to repeat.
|
@Nonnull public static DailyTimeIntervalScheduleBuilder dailyTimeIntervalSchedule()
@Nonnull public DailyTimeIntervalTrigger build()
build in interface IScheduleBuilder<DailyTimeIntervalTrigger>TriggerBuilder.withSchedule(IScheduleBuilder)@Nonnull public DailyTimeIntervalScheduleBuilder withInterval(int timeInterval, @Nonnull EIntervalUnit unit)
timeInterval - the interval at which the trigger should repeat.unit - the time unit (IntervalUnit) of the interval. The only intervals
that are valid for this type of trigger are
EIntervalUnit.SECOND, EIntervalUnit.MINUTE, and
EIntervalUnit.HOUR.IDailyTimeIntervalTrigger.getRepeatInterval(),
IDailyTimeIntervalTrigger.getRepeatIntervalUnit()@Nonnull public DailyTimeIntervalScheduleBuilder withIntervalInSeconds(int intervalInSeconds)
intervalInSeconds - the number of seconds at which the trigger should repeat.IDailyTimeIntervalTrigger.getRepeatInterval(),
IDailyTimeIntervalTrigger.getRepeatIntervalUnit()@Nonnull public DailyTimeIntervalScheduleBuilder withIntervalInMinutes(int intervalInMinutes)
intervalInMinutes - the number of minutes at which the trigger should repeat.IDailyTimeIntervalTrigger.getRepeatInterval(),
IDailyTimeIntervalTrigger.getRepeatIntervalUnit()@Nonnull public DailyTimeIntervalScheduleBuilder withIntervalInHours(int intervalInHours)
intervalInHours - the number of hours at which the trigger should repeat.IDailyTimeIntervalTrigger.getRepeatInterval(),
IDailyTimeIntervalTrigger.getRepeatIntervalUnit()@Nonnull public DailyTimeIntervalScheduleBuilder onDaysOfTheWeek(Set<DayOfWeek> onDaysOfWeek)
onDaysOfWeek - a Set containing the integers representing the days of the week, per
the values 1-7 as defined by Calendar.SUNDAY -
Calendar.SATURDAY.@Nonnull public DailyTimeIntervalScheduleBuilder onDaysOfTheWeek(DayOfWeek... onDaysOfWeek)
onDaysOfWeek - a variable length list of Integers representing the days of the
week, per the values 1-7 as defined by Calendar.SUNDAY -
Calendar.SATURDAY.@Nonnull public DailyTimeIntervalScheduleBuilder onMondayThroughFriday()
@Nonnull public DailyTimeIntervalScheduleBuilder onSaturdayAndSunday()
@Nonnull public DailyTimeIntervalScheduleBuilder onEveryDay()
@Nonnull public DailyTimeIntervalScheduleBuilder startingDailyAt(LocalTime timeOfDay)
@Nonnull public DailyTimeIntervalScheduleBuilder endingDailyAt(LocalTime timeOfDay)
@Nonnull public DailyTimeIntervalScheduleBuilder endingDailyAfterCount(int count)
@Nonnull public DailyTimeIntervalScheduleBuilder withMisfireHandlingInstructionIgnoreMisfires()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY@Nonnull public DailyTimeIntervalScheduleBuilder withMisfireHandlingInstructionDoNothing()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_DO_NOTHING instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_DO_NOTHING@Nonnull public DailyTimeIntervalScheduleBuilder withMisfireHandlingInstructionFireAndProceed()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW@Nonnull public DailyTimeIntervalScheduleBuilder withRepeatCount(int nRepeatCount)
Note: if you want total count = 1 (at start time) + repeatCount
Copyright © 2016–2021 Philip Helger. All rights reserved.