public class CronSchedule extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CronSchedule.AbstractTimeValue
Base class for timing values.
|
static class |
CronSchedule.SingleTimeValue
Represents a single time value, e.g. 9
|
static class |
CronSchedule.TimeAll
Represents the ALL time, *.
|
static class |
CronSchedule.TimeRange
Represents a time range, e.g. 5-9
|
static class |
CronSchedule.TimeSteps
Represents a time interval, e.g. 0-4/10
|
| Modifier and Type | Field and Description |
|---|---|
protected static int[] |
TYPES
Types being used.
|
| Constructor and Description |
|---|
CronSchedule()
Default constructor
Constructor with all terms set to "*".
|
CronSchedule(String schedule)
Constructor with cron-style string initialization.
|
CronSchedule(String min,
String hour,
String dom,
String mon,
String dow)
Constructor with separate initialization values.
|
| Modifier and Type | Method and Description |
|---|---|
String |
get(int type)
Returns the cron-like definition string for the given time value
|
protected Calendar |
getCalendar(long timeStamp)
Creates the calendar for a timestamp.
|
protected static int |
getIndex(int type)
Returns the index for the specified Calendar type.
|
protected static int |
getType(int index)
Returns the type at the specified index
|
protected CronSchedule.AbstractTimeValue[] |
getValues(int type)
Returns the values for a specific time type
|
boolean |
isDay(Calendar cal)
Checks whether given calendar date matches with defined day schedule.
|
boolean |
isDay(long timestamp)
Checks whether given timestamp matches with defined day schedule.
|
boolean |
isHour(Calendar cal)
Checks whether given calendar date matches with defined hour schedule.
|
boolean |
isHour(long timestamp)
Checks whether given timestamp matches with defined hour schedule.
|
boolean |
isMinute(Calendar cal)
Checks whether given calendar date matches with defined schedule.
|
boolean |
isMinute(long timeStamp)
Checks whether given timestamp matches with defined schedule.
|
boolean |
matches(Calendar cal)
Checks whether given timestamp matches with defined schedule.
|
protected boolean |
matches(int type,
Calendar calendar)
Checks whether specific schedule definition matches against the given calendar date.
|
boolean |
matches(long timeStamp)
Checks whether given timestamp matches with defined schedule.
|
protected void |
set(int type,
CronSchedule.AbstractTimeValue[] values)
Sets the values for a specific type
|
void |
set(int type,
String values)
Sets the time values accordingly
|
String |
set(String schedule)
Sets the cron schedule.
|
String |
toString()
Returns the cron-like definition of the schedule.
|
protected static int[] TYPES
public CronSchedule()
public CronSchedule(String schedule)
schedule - public String set(String schedule)
schedule - - cron-like schedule definitionpublic void set(int type,
String values)
type - - Calendar constant to define what values will be setvalues - - comma-separated list of definitions for that typeprotected void set(int type,
CronSchedule.AbstractTimeValue[] values)
type - - Calendar constant defining the time typevalues - - values to be setprotected CronSchedule.AbstractTimeValue[] getValues(int type)
type - - Calendar constant defining the typepublic String get(int type)
type - - Calendar constant defining time typepublic String toString()
public boolean matches(long timeStamp)
timeStamp - - time in ms since Epoch timepublic boolean matches(Calendar cal)
cal - - calendar datepublic boolean isMinute(long timeStamp)
timeStamp - - time in ms since Epoch timepublic boolean isMinute(Calendar cal)
cal - - calendar datepublic boolean isHour(long timestamp)
timestamp - - time in ms since Epoch timepublic boolean isHour(Calendar cal)
cal - - calendar datepublic boolean isDay(long timestamp)
timestamp - - time in ms since Epoch timepublic boolean isDay(Calendar cal)
cal - - calendar dateprotected boolean matches(int type,
Calendar calendar)
type - - Calendar constant defining time type to check forcalendar - - calendar representing the date to checkprotected Calendar getCalendar(long timeStamp)
timeStamp - - timestampprotected static int getType(int index)
index - - indexprotected static int getIndex(int type)
type - - Calendar constant for typeCopyright © 2014. All rights reserved.