public class CronSchedule
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CronSchedule.Field
Class representing one field of a crontab schedule specification.
|
static class |
CronSchedule.SpecException
Exception class thrown to indicate a problem with a crontab schedule specification. |
| Constructor and Description |
|---|
CronSchedule()
Create a
CronSchedule instance. |
CronSchedule(java.lang.String spec)
Construct a
CronSchedule instance according to the passed crontab-style
specification. |
| Modifier and Type | Method and Description |
|---|---|
CronSchedule.Field |
getDaysOfMonth()
Return the
Field instance containing the "days-of-the-month" schedule. |
CronSchedule.Field |
getDaysOfWeek()
Return the
Field instance containing the "day-of-the-week" schedule. |
CronSchedule.Field |
getHours()
Return the
Field instance containing the "hours" schedule. |
CronSchedule.Field |
getMinutes()
Return the
Field instance containing the "minutes" schedule. |
CronSchedule.Field |
getMonths()
Return the
Field instance containing the "month-of-the-year" schedule. |
java.util.Calendar |
getNextScheduledTime()
Return a
Calendar instance representing the next
instant in time that is scheduled by this CronSchedule
instance. |
java.util.Calendar |
getNextScheduledTime(java.util.Calendar start)
Return a
Calendar instance representing the next
instant in time after the passed time that is scheduled by this CronSchedule
instance. |
boolean |
isScheduled(java.util.Calendar time)
Return
true if the passed time is scheduled by this CronSchedule instance. |
void |
reset()
Set this instance to the equivalent of
"* * * * *". |
java.lang.String |
toString()
Return a string representation of this
CronSchedule instance. |
public CronSchedule()
CronSchedule instance. The created instance
is the same as if it had been created bynew CronSchedule("* * * * *")public CronSchedule(java.lang.String spec)
throws CronSchedule.SpecException
CronSchedule instance according to the passed crontab-style
specification. The passed specification must have the 5 schedule fields
defined by crontab.spec - schedule specificationCronSchedule.SpecException - thrown if there is something wrong with the
specification string.public void reset()
"* * * * *".public CronSchedule.Field getMinutes()
Field instance containing the "minutes" schedule.Field containing minutespublic CronSchedule.Field getHours()
Field instance containing the "hours" schedule.Field containing hourspublic CronSchedule.Field getDaysOfMonth()
Field instance containing the "days-of-the-month" schedule.Field containing days-of-the-monthpublic CronSchedule.Field getMonths()
Field instance containing the "month-of-the-year" schedule.Field containing month-of-the-yearpublic CronSchedule.Field getDaysOfWeek()
Field instance containing the "day-of-the-week" schedule.Field containing day-of-the-weekpublic boolean isScheduled(java.util.Calendar time)
true if the passed time is scheduled by this CronSchedule instance.time - time to checktrue if scheduledpublic java.util.Calendar getNextScheduledTime()
Calendar instance representing the next
instant in time that is scheduled by this CronSchedule
instance.
This is a convenience method; it behaves as the following:getNextScheduledTime(Calendar.getInstance())Calendar instance representing the next scheduled time.public java.util.Calendar getNextScheduledTime(java.util.Calendar start)
Calendar instance representing the next
instant in time after the passed time that is scheduled by this CronSchedule
instance.start - time from which to calculate the next scheduled timeCalendar instance representing the next scheduled time after the
passed reference time.public java.lang.String toString()
CronSchedule instance. This will, in general,
be the same string that was used to construct the instance.toString in class java.lang.Object