Package org.redisson.executor
Class CronExpression
-
- org.redisson.executor.CronExpression
-
- All Implemented Interfaces:
,
public final class CronExpression extends implements ,
- Author:
- Sharada Jambula, James House, Contributions from Mads Henderson, Refactoring from CronTrigger to CronExpression by Aaron Craven
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static
ALL_SPEC
protected static int
ALL_SPEC_INT
protected static int
DAY_OF_MONTH
protected static int
DAY_OF_WEEK
protected static <,>
dayMap
protected <>
daysOfMonth
protected <>
daysOfWeek
protected boolean
expressionParsed
protected static int
HOUR
protected <>
hours
protected int
lastdayOffset
protected boolean
lastdayOfMonth
protected boolean
lastdayOfWeek
static int
MAX_YEAR
protected static int
MINUTE
protected <>
minutes
protected static int
MONTH
protected static <,>
monthMap
protected <>
months
protected boolean
nearestWeekday
protected static
NO_SPEC
protected static int
NO_SPEC_INT
protected int
nthdayOfWeek
protected static int
SECOND
protected <>
seconds
protected static int
YEAR
protected <>
years
-
Constructor Summary
Constructors Constructor Description cronExpression)
Constructs a newCronExpression
based on the specified parameter.CronExpression(CronExpression expression)
Constructs a newCronExpression
as a copy of an existing instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected void
addToSet(int val, int end, int incr, int type)
protected void
expression)
protected int
checkNext(int pos, s, int val, int type)
clone()
Deprecated.protected int
findNextWhiteSpace(int i, s)
getCronExpression()
protected int
s)
protected
<> list)
protected
<> set)
getExpressionSummary()
getFinalFireTime()
protected int
getLastDayOfMonth(int monthNum, int year)
protected int
s)
date)
Returns the next date/time after the given date/time which does not satisfy the expressiondate)
Returns the next date/time after the given date/time which satisfies the cron expression.protected int
s, int i)
afterTime)
endTime)
getTimeZone()
Returns the time zone for which thisCronExpression
will be resolved.protected org.redisson.executor.ValueSet
getValue(int v, s, int i)
protected boolean
isLeapYear(int year)
boolean
date)
Indicates whether the given date satisfies the cron expression.static boolean
cronExpression)
Indicates whether the specified cron expression can be parsed into a valid cron expressionprotected void
cal, int hour)
Advance the calendar to the particular hour paying particular attention to daylight saving problems.void
timeZone)
Sets the time zone for which thisCronExpression
will be resolved.protected int
skipWhiteSpace(int i, s)
protected int
storeExpressionVals(int pos, s, int type)
toString()
Returns the string representation of theCronExpression
static void
cronExpression)
-
-
-
Field Detail
-
SECOND
protected static final int SECOND
- See Also:
- Constant Field Values
-
MINUTE
protected static final int MINUTE
- See Also:
- Constant Field Values
-
HOUR
protected static final int HOUR
- See Also:
- Constant Field Values
-
DAY_OF_MONTH
protected static final int DAY_OF_MONTH
- See Also:
- Constant Field Values
-
MONTH
protected static final int MONTH
- See Also:
- Constant Field Values
-
DAY_OF_WEEK
protected static final int DAY_OF_WEEK
- See Also:
- Constant Field Values
-
YEAR
protected static final int YEAR
- See Also:
- Constant Field Values
-
ALL_SPEC_INT
protected static final int ALL_SPEC_INT
- See Also:
- Constant Field Values
-
NO_SPEC_INT
protected static final int NO_SPEC_INT
- See Also:
- Constant Field Values
-
ALL_SPEC
protected static final ALL_SPEC
-
NO_SPEC
protected static final NO_SPEC
-
monthMap
protected static final <,> monthMap
-
dayMap
protected static final <,> dayMap
-
seconds
protected transient <> seconds
-
minutes
protected transient <> minutes
-
hours
protected transient <> hours
-
daysOfMonth
protected transient <> daysOfMonth
-
months
protected transient <> months
-
daysOfWeek
protected transient <> daysOfWeek
-
years
protected transient <> years
-
lastdayOfWeek
protected transient boolean lastdayOfWeek
-
nthdayOfWeek
protected transient int nthdayOfWeek
-
lastdayOfMonth
protected transient boolean lastdayOfMonth
-
nearestWeekday
protected transient boolean nearestWeekday
-
lastdayOffset
protected transient int lastdayOffset
-
expressionParsed
protected transient boolean expressionParsed
-
MAX_YEAR
public static final int MAX_YEAR
-
-
Constructor Detail
-
CronExpression
public CronExpression( cronExpression)
Constructs a newCronExpression
based on the specified parameter.- Parameters:
cronExpression
- String representation of the cron expression the new object should represent
-
CronExpression
public CronExpression(CronExpression expression)
Constructs a newCronExpression
as a copy of an existing instance.- Parameters:
expression
- The existing cron expression to be copied
-
-
Method Detail
-
isSatisfiedBy
public boolean isSatisfiedBy( date)
Indicates whether the given date satisfies the cron expression. Note that milliseconds are ignored, so two Dates falling on different milliseconds of the same second will always have the same result here.- Parameters:
date
- the date to evaluate- Returns:
- a boolean indicating whether the given date satisfies the cron expression
-
getNextValidTimeAfter
public getNextValidTimeAfter( date)
Returns the next date/time after the given date/time which satisfies the cron expression.- Parameters:
date
- the date/time at which to begin the search for the next valid date/time- Returns:
- the next valid date/time
-
getNextInvalidTimeAfter
public getNextInvalidTimeAfter( date)
Returns the next date/time after the given date/time which does not satisfy the expression- Parameters:
date
- the date/time at which to begin the search for the next invalid date/time- Returns:
- the next valid date/time
-
getTimeZone
public getTimeZone()
Returns the time zone for which thisCronExpression
will be resolved.- Returns:
- time zone
-
setTimeZone
public void setTimeZone( timeZone)
Sets the time zone for which thisCronExpression
will be resolved.- Parameters:
timeZone
- object
-
toString
public toString()
Returns the string representation of theCronExpression
- Overrides:
in class
- Returns:
- a string representation of the
CronExpression
-
isValidExpression
public static boolean isValidExpression( cronExpression)
Indicates whether the specified cron expression can be parsed into a valid cron expression- Parameters:
cronExpression
- the expression to evaluate- Returns:
- a boolean indicating whether the given expression is a valid cron expression
-
validateExpression
public static void validateExpression( cronExpression) throws
- Throws:
-
buildExpression
protected void buildExpression( expression) throws
- Throws:
-
storeExpressionVals
protected int storeExpressionVals(int pos, s, int type) throws
- Throws:
-
checkNext
protected int checkNext(int pos, s, int val, int type) throws
- Throws:
-
getCronExpression
public getCronExpression()
-
getExpressionSummary
public getExpressionSummary()
-
getExpressionSetSummary
protected getExpressionSetSummary(<> set)
-
getExpressionSetSummary
protected getExpressionSetSummary(<> list)
-
skipWhiteSpace
protected int skipWhiteSpace(int i, s)
-
findNextWhiteSpace
protected int findNextWhiteSpace(int i, s)
-
addToSet
protected void addToSet(int val, int end, int incr, int type) throws
- Throws:
-
getValue
protected org.redisson.executor.ValueSet getValue(int v, s, int i)
-
getNumericValue
protected int getNumericValue( s, int i)
-
getMonthNumber
protected int getMonthNumber( s)
-
getDayOfWeekNumber
protected int getDayOfWeekNumber( s)
-
getTimeAfter
public getTimeAfter( afterTime)
-
setCalendarHour
protected void setCalendarHour( cal, int hour)
Advance the calendar to the particular hour paying particular attention to daylight saving problems.- Parameters:
cal
- the calendar to operate onhour
- the hour to set
-
getTimeBefore
public getTimeBefore( endTime)
-
getFinalFireTime
public getFinalFireTime()
-
isLeapYear
protected boolean isLeapYear(int year)
-
getLastDayOfMonth
protected int getLastDayOfMonth(int monthNum, int year)
-
clone
public clone()
Deprecated.- Overrides:
in class
-
-