diff --git a/README.md b/README.md
index c8da945c..33519bb3 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ A Java framework with VERT.X eco, for projects for web, job and more.
io.github.sinri
Keel
- 3.1.9
+ 3.2.2
```
diff --git a/pom.xml b/pom.xml
index 4075c04f..13a71cc1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,18 +4,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
-
- UTF-8
- 4.5.4
- 0.21.0
- 2.15.3
- 5.2.5
-
-
io.github.sinri
Keel
- 3.2.3-SNAPSHOT
-
+
+ 3.2.4
Keel
@@ -44,6 +36,14 @@
+
+ UTF-8
+ 4.5.7
+ 0.21.0
+ 2.15.3
+ 5.2.5
+
+
io.vertx
@@ -145,6 +145,11 @@
vertx-redis-client
${vertxVersion}
+
+ io.vertx
+ vertx-json-schema
+ ${vertxVersion}
+
org.apache.poi
poi
diff --git a/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java b/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java
index 4d9d86cd..b29cd582 100644
--- a/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java
+++ b/src/main/java/io/github/sinri/keel/core/KeelCronExpression.java
@@ -1,5 +1,7 @@
package io.github.sinri.keel.core;
+
+import javax.annotation.Nonnull;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -13,9 +15,9 @@ public class KeelCronExpression {
final Set dayOptions = new HashSet<>();
final Set monthOptions = new HashSet<>();
final Set weekdayOptions = new HashSet<>();
- private final String rawCronExpression;
+ private final @Nonnull String rawCronExpression;
- public KeelCronExpression(String rawCronExpression) {
+ public KeelCronExpression(@Nonnull String rawCronExpression) {
this.rawCronExpression = rawCronExpression;
String[] parts = rawCronExpression.trim().split("\\s+");
@@ -36,24 +38,20 @@ public KeelCronExpression(String rawCronExpression) {
parseField(weekdayExpression, weekdayOptions, 0, 6);
}
- public boolean match(Calendar currentCalendar) {
- // currentCalendar := Calendar.getInstance();
- int minute = currentCalendar.get(Calendar.MINUTE);
- int hour = currentCalendar.get(Calendar.HOUR_OF_DAY);
- int day = currentCalendar.get(Calendar.DAY_OF_MONTH);
- int month = 1 + currentCalendar.get(Calendar.MONTH);// make JAN 1, ...
- int weekday = currentCalendar.get(Calendar.DAY_OF_WEEK) - 1; // make sunday 0, ...
-
- return minuteOptions.contains(minute)
- && hourOptions.contains(hour)
- && dayOptions.contains(day)
- && monthOptions.contains(month)
- && weekdayOptions.contains(weekday);
+ public boolean match(@Nonnull Calendar currentCalendar) {
+ ParsedCalenderElements parsedCalenderElements = new ParsedCalenderElements(currentCalendar);
+ return match(parsedCalenderElements);
}
- private void parseField(String rawComponent, Set optionSet, int min, int max) {
-// System.out.println("parseField: " + rawComponent);
+ public boolean match(@Nonnull ParsedCalenderElements parsedCalenderElements) {
+ return minuteOptions.contains(parsedCalenderElements.minute)
+ && hourOptions.contains(parsedCalenderElements.hour)
+ && dayOptions.contains(parsedCalenderElements.day)
+ && monthOptions.contains(parsedCalenderElements.month)
+ && weekdayOptions.contains(parsedCalenderElements.weekday);
+ }
+ private void parseField(@Nonnull String rawComponent, @Nonnull Set optionSet, int min, int max) {
if (rawComponent.equals("*")) {
for (int i = min; i <= max; i++) {
optionSet.add(i);
@@ -106,10 +104,46 @@ private void parseField(String rawComponent, Set optionSet, int min, in
}
}
+ /**
+ * @since 3.2.4
+ */
+ public static ParsedCalenderElements parseCalenderToElements(@Nonnull Calendar currentCalendar) {
+ return new ParsedCalenderElements(currentCalendar);
+ }
+
+ @Nonnull
public String getRawCronExpression() {
return rawCronExpression;
}
+ /**
+ * @since 3.2.4
+ */
+ public static class ParsedCalenderElements {
+ public final int minute;
+ public final int hour;
+ public final int day;
+ public final int month;
+ public final int weekday;
+
+ // debug use
+ public final int second;
+
+ public ParsedCalenderElements(@Nonnull Calendar currentCalendar) {
+ minute = currentCalendar.get(Calendar.MINUTE);
+ hour = currentCalendar.get(Calendar.HOUR_OF_DAY);
+ day = currentCalendar.get(Calendar.DAY_OF_MONTH);
+ month = 1 + currentCalendar.get(Calendar.MONTH);// make JAN 1, ...
+ weekday = currentCalendar.get(Calendar.DAY_OF_WEEK) - 1; // make sunday 0, ...
+ second = currentCalendar.get(Calendar.SECOND);
+ }
+
+ @Override
+ public String toString() {
+ return "(" + second + ") " + minute + " " + hour + " " + day + " " + month + " " + weekday;
+ }
+ }
+
@Override
public String toString() {
return getRawCronExpression();
diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java
index 35834fa4..1e5b5d7d 100644
--- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java
+++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonArrayScheme.java
@@ -10,6 +10,7 @@
/**
* @since 2.7
*/
+@Deprecated(since = "3.2.4")
public class JsonArrayScheme extends JsonValueScheme {
private final Map> indexedElementSchemeMap = new LinkedHashMap<>();
private JsonElementScheme> defaultElementScheme;
diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java
index fd19fc7a..87c90b2d 100644
--- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java
+++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonBooleanScheme.java
@@ -7,6 +7,7 @@
/**
* @since 2.7
*/
+@Deprecated(since = "3.2.4")
public class JsonBooleanScheme extends JsonValueScheme {
private Boolean expected;
diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java
index 51d0f274..206873c8 100644
--- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java
+++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonElementScheme.java
@@ -6,6 +6,7 @@
/**
* @since 2.7
*/
+@Deprecated(since = "3.2.4")
public interface JsonElementScheme extends JsonifiableEntity> {
static JsonElementScheme> fromJsonObject(JsonObject jsonObject) {
JsonElementSchemeType scheme_type = JsonElementSchemeType.valueOf(jsonObject.getString("scheme_type"));
diff --git a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java
index bc5f0ceb..66a7c1a4 100644
--- a/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java
+++ b/src/main/java/io/github/sinri/keel/core/json/scheme/JsonNullScheme.java
@@ -7,6 +7,7 @@
/**
* @since 2.7
*/
+@Deprecated(since = "3.2.4")
public class JsonNullScheme extends JsonValueScheme