public class DayOfWeekFieldRule extends Object
This field works a bit differently from any of the others and needs its own implementation rather than
using BitSetFieldRule. The day-of-week value is not stored as one of the items in
DateTimeTemplate because it is not independent — it is a function of the the year, month,
and day-of-month values. Moving to another day-of-week value is implemented in terms of moving to the
next day-of-month value for which that function yields the desired result while holding the year and month
values fixed. To add to the fun, we also need to convert between the cron and ISO numbering conventions
for the day-of-week value.
| Modifier and Type | Field and Description |
|---|---|
protected DateTimeTemplate.Field |
field |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendTo(StringBuilder sb)
Reports the information about how this field is configured.
|
boolean |
first(DateTimeTemplate dateTime)
Resets
dateTime to the minimum matching value for this rule, if possible. |
int |
get(DateTimeTemplate dateTime)
Returns the currently set value for this field.
|
boolean |
matches(DateTimeTemplate dateTime)
Returns
true if dateTime matches the rule; false if it does not. |
boolean |
next(DateTimeTemplate dateTime)
Advance
dateTime to when the rule would next match, if possible. |
static FieldRule |
of(BitSet values) |
static DayOfWeekFieldRule |
saturday()
Returns a singleton that represents matching on Saturday only.
|
void |
set(DateTimeTemplate dateTime,
int value)
Modifies the value for this field to produce a new moment for consideration.
|
String |
toString() |
protected Object |
writeReplace() |
protected final DateTimeTemplate.Field field
public static DayOfWeekFieldRule saturday()
L
for the day-of-week field. We would otherwise have to build up a new isoDaysOfWeek bitset
with just a 6 in it anyway, and since the rules are stateless we can just reuse this same
one forever.public boolean matches(DateTimeTemplate dateTime)
CronRuletrue if dateTime matches the rule; false if it does not.dateTime - the moment to consider as a match for the ruletrue if dateTime matches the rule; false if it does not.public boolean first(DateTimeTemplate dateTime)
CronRuledateTime to the minimum matching value for this rule, if possible.dateTime - the time to modify by resetting the value that this rule evaluates to its minimum matching valuetrue if dateTime has successfully been updated to when the rule would first match;
false if there are no matching values for this rule (at least without some other rule changing
dateTime in some other way first).public boolean next(DateTimeTemplate dateTime)
CronRuledateTime to when the rule would next match, if possible.dateTime - the time to modify by changing the value that this rule evaluates to its next matching valuetrue if dateTime has successfully been updated to when the rule would next match;
false if all legal values have been exhausted for this rule (at least without some other
rule changing dateTime in some other way first).protected void appendTo(StringBuilder sb)
sb - a buffer to append with the field's informationprotected Object writeReplace()
public int get(DateTimeTemplate dateTime)
FieldRulepublic void set(DateTimeTemplate dateTime, int value)
FieldRuleCopyright © 2019 Atlassian. All rights reserved.