Package org.redisson.executor
Class CronExpression
java.lang.Object
org.redisson.executor.CronExpression
- All Implemented Interfaces:
Serializable,Cloneable
- Author:
- Sharada Jambula, James House, Contributions from Mads Henderson, Refactoring from CronTrigger to CronExpression by Aaron Craven
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Integerprotected static final intprotected static final intprotected static final intprotected booleanprotected static final intprotected intprotected booleanprotected booleanstatic final intprotected static final intprotected static final intprotected booleanprotected static final Integerprotected static final intprotected intprotected static final intprotected static final int -
Constructor Summary
ConstructorsConstructorDescriptionCronExpression(String cronExpression) Constructs a newCronExpressionbased on the specified parameter.CronExpression(CronExpression expression) Constructs a newCronExpressionas a copy of an existing instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToSet(int val, int end, int incr, int type) protected voidbuildExpression(String expression) protected intclone()Deprecated.protected intfindNextWhiteSpace(int i, String s) protected intprotected Stringprotected Stringprotected intgetLastDayOfMonth(int monthNum, int year) protected intgetNextInvalidTimeAfter(Date date) Returns the next date/time after the given date/time which does not satisfy the expressiongetNextValidTimeAfter(Date date) Returns the next date/time after the given date/time which satisfies the cron expression.protected intgetNumericValue(String s, int i) getTimeAfter(Date afterTime) getTimeBefore(Date endTime) Returns the time zone for which thisCronExpressionwill be resolved.protected org.redisson.executor.ValueSetprotected booleanisLeapYear(int year) booleanisSatisfiedBy(Date date) Indicates whether the given date satisfies the cron expression.static booleanisValidExpression(String cronExpression) Indicates whether the specified cron expression can be parsed into a valid cron expressionprotected voidsetCalendarHour(Calendar cal, int hour) Advance the calendar to the particular hour paying particular attention to daylight saving problems.voidsetTimeZone(TimeZone timeZone) Sets the time zone for which thisCronExpressionwill be resolved.protected intskipWhiteSpace(int i, String s) protected intstoreExpressionVals(int pos, String s, int type) toString()Returns the string representation of theCronExpressionstatic voidvalidateExpression(String cronExpression)
-
Field Details
-
SECOND
protected static final int SECOND- See Also:
-
MINUTE
protected static final int MINUTE- See Also:
-
HOUR
protected static final int HOUR- See Also:
-
DAY_OF_MONTH
protected static final int DAY_OF_MONTH- See Also:
-
MONTH
protected static final int MONTH- See Also:
-
DAY_OF_WEEK
protected static final int DAY_OF_WEEK- See Also:
-
YEAR
protected static final int YEAR- See Also:
-
ALL_SPEC_INT
protected static final int ALL_SPEC_INT- See Also:
-
NO_SPEC_INT
protected static final int NO_SPEC_INT- See Also:
-
ALL_SPEC
-
NO_SPEC
-
monthMap
-
dayMap
-
seconds
-
minutes
-
hours
-
daysOfMonth
-
months
-
daysOfWeek
-
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 Details
-
CronExpression
Constructs a newCronExpressionbased on the specified parameter.- Parameters:
cronExpression- String representation of the cron expression the new object should represent
-
CronExpression
Constructs a newCronExpressionas a copy of an existing instance.- Parameters:
expression- The existing cron expression to be copied
-
-
Method Details
-
isSatisfiedBy
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
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
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
Returns the time zone for which thisCronExpressionwill be resolved.- Returns:
- time zone
-
setTimeZone
Sets the time zone for which thisCronExpressionwill be resolved.- Parameters:
timeZone- object
-
toString
Returns the string representation of theCronExpression -
isValidExpression
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
- Throws:
ParseException
-
buildExpression
- Throws:
ParseException
-
storeExpressionVals
- Throws:
ParseException
-
checkNext
- Throws:
ParseException
-
getCronExpression
-
getExpressionSummary
-
getExpressionSetSummary
-
getExpressionSetSummary
-
skipWhiteSpace
-
findNextWhiteSpace
-
addToSet
- Throws:
ParseException
-
getValue
-
getNumericValue
-
getMonthNumber
-
getDayOfWeekNumber
-
getTimeAfter
-
setCalendarHour
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
-
getFinalFireTime
-
isLeapYear
protected boolean isLeapYear(int year) -
getLastDayOfMonth
protected int getLastDayOfMonth(int monthNum, int year) -
clone
Deprecated.
-