Commit e134975c by Sebastián Katzer

Support weekday and weekOfMonth matchers on Android

parent d93534ba
......@@ -151,7 +151,10 @@ public final class Request {
Object every = spec.opt("every");
if (every instanceof JSONObject) {
return new MatchTrigger(getDateMatchingComponents());
List<Integer> cmp1 = getMatchingComponents();
List<Integer> cmp2 = getSpecialMatchingComponents();
return new MatchTrigger(cmp1, cmp2);
}
Unit unit = getUnit();
......@@ -205,7 +208,7 @@ public final class Request {
*
* @return [min, hour, day, month, year]
*/
private List<Integer> getDateMatchingComponents() {
private List<Integer> getMatchingComponents() {
JSONObject every = spec.optJSONObject("every");
return Arrays.asList(
......@@ -218,6 +221,22 @@ public final class Request {
}
/**
* Gets an array of all date parts to construct a datetime instance.
*
* @return [min, hour, day, month, year]
*/
private List<Integer> getSpecialMatchingComponents() {
JSONObject every = spec.optJSONObject("every");
return Arrays.asList(
(Integer) every.opt("weekday"),
(Integer) every.opt("weekdayOrdinal"),
(Integer) every.opt("weekOfMonth"),
(Integer) every.opt("quarter")
);
}
/**
* Gets the base date from where to calculate the next trigger date.
*/
private Date getBaseDate() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment