diff --git a/pom.xml b/pom.xml
index aa68b1a..994ed99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,6 @@
1.8
1.18.24
2.13.4
- 5.8.11
@@ -29,10 +28,5 @@
jackson-annotations
${jackson.version}
-
- cn.hutool
- hutool-core
- ${hutool.version}
-
\ No newline at end of file
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/constant/PatternConsts.java b/src/main/java/xyz/zhouxy/plusone/commons/constant/PatternConsts.java
new file mode 100644
index 0000000..9efcf24
--- /dev/null
+++ b/src/main/java/xyz/zhouxy/plusone/commons/constant/PatternConsts.java
@@ -0,0 +1,29 @@
+package xyz.zhouxy.plusone.commons.constant;
+
+import java.util.regex.Pattern;
+
+/**
+ * 正则表达式常量
+ *
+ * @author ZhouXY
+ */
+public final class PatternConsts {
+
+ public static final Pattern DATE = Pattern.compile(RegexConsts.DATE);
+
+ public static final Pattern PASSWORD = Pattern.compile(RegexConsts.PASSWORD);
+
+ public static final Pattern CAPTCHA = Pattern.compile(RegexConsts.CAPTCHA);
+
+ public static final Pattern EMAIL = Pattern.compile(RegexConsts.EMAIL);
+
+ public static final Pattern MOBILE_PHONE = Pattern.compile(RegexConsts.MOBILE_PHONE);
+
+ public static final Pattern USERNAME = Pattern.compile(RegexConsts.USERNAME);
+
+ public static final Pattern NICKNAME = Pattern.compile(RegexConsts.NICKNAME);
+
+ private PatternConsts() {
+ throw new IllegalStateException("Utility class");
+ }
+}
diff --git a/src/main/java/xyz/zhouxy/plusone/constant/RegexConsts.java b/src/main/java/xyz/zhouxy/plusone/commons/constant/RegexConsts.java
similarity index 95%
rename from src/main/java/xyz/zhouxy/plusone/constant/RegexConsts.java
rename to src/main/java/xyz/zhouxy/plusone/commons/constant/RegexConsts.java
index a34c436..2daf331 100644
--- a/src/main/java/xyz/zhouxy/plusone/constant/RegexConsts.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/constant/RegexConsts.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.constant;
+package xyz.zhouxy.plusone.commons.constant;
/**
* 正则表达式常量
diff --git a/src/main/java/xyz/zhouxy/plusone/exception/BaseException.java b/src/main/java/xyz/zhouxy/plusone/commons/exception/BaseException.java
similarity index 70%
rename from src/main/java/xyz/zhouxy/plusone/exception/BaseException.java
rename to src/main/java/xyz/zhouxy/plusone/commons/exception/BaseException.java
index ac6cb7e..87cf1d7 100644
--- a/src/main/java/xyz/zhouxy/plusone/exception/BaseException.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/exception/BaseException.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.exception;
+package xyz.zhouxy.plusone.commons.exception;
/**
* 带错误码的异常。
@@ -11,17 +11,17 @@ public abstract class BaseException extends RuntimeException implements IWithCod
private final int code;
- public BaseException(int code, String msg) {
+ protected BaseException(int code, String msg) {
super(msg);
this.code = code;
}
- public BaseException(int code, Throwable cause) {
+ protected BaseException(int code, Throwable cause) {
super(cause);
this.code = code;
}
- public BaseException(int code, String msg, Throwable cause) {
+ protected BaseException(int code, String msg, Throwable cause) {
super(msg, cause);
this.code = code;
}
diff --git a/src/main/java/xyz/zhouxy/plusone/exception/IWithCode.java b/src/main/java/xyz/zhouxy/plusone/commons/exception/IWithCode.java
similarity index 89%
rename from src/main/java/xyz/zhouxy/plusone/exception/IWithCode.java
rename to src/main/java/xyz/zhouxy/plusone/commons/exception/IWithCode.java
index c559573..8671f54 100644
--- a/src/main/java/xyz/zhouxy/plusone/exception/IWithCode.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/exception/IWithCode.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.exception;
+package xyz.zhouxy.plusone.commons.exception;
/**
* 规定实现类带有 {@code getCode} 方法。
diff --git a/src/main/java/xyz/zhouxy/plusone/util/EnumUtil.java b/src/main/java/xyz/zhouxy/plusone/commons/util/EnumUtil.java
similarity index 98%
rename from src/main/java/xyz/zhouxy/plusone/util/EnumUtil.java
rename to src/main/java/xyz/zhouxy/plusone/commons/util/EnumUtil.java
index 522ed87..832d270 100644
--- a/src/main/java/xyz/zhouxy/plusone/util/EnumUtil.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/util/EnumUtil.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.util;
+package xyz.zhouxy.plusone.commons.util;
import java.util.Objects;
diff --git a/src/main/java/xyz/zhouxy/plusone/util/Enumeration.java b/src/main/java/xyz/zhouxy/plusone/commons/util/Enumeration.java
similarity index 96%
rename from src/main/java/xyz/zhouxy/plusone/util/Enumeration.java
rename to src/main/java/xyz/zhouxy/plusone/commons/util/Enumeration.java
index 4ad6e6e..f94a4a8 100644
--- a/src/main/java/xyz/zhouxy/plusone/util/Enumeration.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/util/Enumeration.java
@@ -1,9 +1,12 @@
-package xyz.zhouxy.plusone.util;
+package xyz.zhouxy.plusone.commons.util;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
+/**
+ * 枚举类
+ */
public abstract class Enumeration> {
protected final int value;
protected final String name;
diff --git a/src/main/java/xyz/zhouxy/plusone/util/NumberUtil.java b/src/main/java/xyz/zhouxy/plusone/commons/util/NumberUtil.java
similarity index 93%
rename from src/main/java/xyz/zhouxy/plusone/util/NumberUtil.java
rename to src/main/java/xyz/zhouxy/plusone/commons/util/NumberUtil.java
index b5bac8b..7078ba3 100644
--- a/src/main/java/xyz/zhouxy/plusone/util/NumberUtil.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/util/NumberUtil.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.util;
+package xyz.zhouxy.plusone.commons.util;
/**
* NumberUtil
diff --git a/src/main/java/xyz/zhouxy/plusone/util/PageDTO.java b/src/main/java/xyz/zhouxy/plusone/commons/util/PageDTO.java
similarity index 94%
rename from src/main/java/xyz/zhouxy/plusone/util/PageDTO.java
rename to src/main/java/xyz/zhouxy/plusone/commons/util/PageDTO.java
index dce9bc8..9fa076a 100644
--- a/src/main/java/xyz/zhouxy/plusone/util/PageDTO.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/util/PageDTO.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.util;
+package xyz.zhouxy.plusone.commons.util;
import java.util.List;
diff --git a/src/main/java/xyz/zhouxy/plusone/util/PagingAndSortingQueryParams.java b/src/main/java/xyz/zhouxy/plusone/commons/util/PagingAndSortingQueryParams.java
similarity index 96%
rename from src/main/java/xyz/zhouxy/plusone/util/PagingAndSortingQueryParams.java
rename to src/main/java/xyz/zhouxy/plusone/commons/util/PagingAndSortingQueryParams.java
index 78b2ddf..9dadeca 100644
--- a/src/main/java/xyz/zhouxy/plusone/util/PagingAndSortingQueryParams.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/util/PagingAndSortingQueryParams.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.util;
+package xyz.zhouxy.plusone.commons.util;
import java.util.Arrays;
import java.util.Collections;
diff --git a/src/main/java/xyz/zhouxy/plusone/commons/util/RegexUtil.java b/src/main/java/xyz/zhouxy/plusone/commons/util/RegexUtil.java
new file mode 100644
index 0000000..7550721
--- /dev/null
+++ b/src/main/java/xyz/zhouxy/plusone/commons/util/RegexUtil.java
@@ -0,0 +1,38 @@
+package xyz.zhouxy.plusone.commons.util;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class RegexUtil {
+
+ public static boolean matches(CharSequence input, Pattern regex) {
+ Matcher m = regex.matcher(input);
+ return m.matches();
+ }
+
+ public static boolean matchesOr(CharSequence input, Pattern... regexs) {
+ boolean isMatched;
+ for (Pattern regex : regexs) {
+ isMatched = matches(input, regex);
+ if (isMatched) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean matchesAnd(CharSequence input, Pattern... regexs) {
+ boolean isMatched;
+ for (Pattern regex : regexs) {
+ isMatched = matches(input, regex);
+ if (!isMatched) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private RegexUtil() {
+ throw new IllegalStateException("Utility class");
+ }
+}
diff --git a/src/main/java/xyz/zhouxy/plusone/util/RestfulResult.java b/src/main/java/xyz/zhouxy/plusone/commons/util/RestfulResult.java
similarity index 97%
rename from src/main/java/xyz/zhouxy/plusone/util/RestfulResult.java
rename to src/main/java/xyz/zhouxy/plusone/commons/util/RestfulResult.java
index 7a596c5..674d77f 100644
--- a/src/main/java/xyz/zhouxy/plusone/util/RestfulResult.java
+++ b/src/main/java/xyz/zhouxy/plusone/commons/util/RestfulResult.java
@@ -1,4 +1,4 @@
-package xyz.zhouxy.plusone.util;
+package xyz.zhouxy.plusone.commons.util;
import com.fasterxml.jackson.annotation.JsonInclude;
diff --git a/src/main/java/xyz/zhouxy/plusone/util/RegexUtil.java b/src/main/java/xyz/zhouxy/plusone/util/RegexUtil.java
deleted file mode 100644
index 9f88a04..0000000
--- a/src/main/java/xyz/zhouxy/plusone/util/RegexUtil.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package xyz.zhouxy.plusone.util;
-
-import java.util.regex.Pattern;
-
-import cn.hutool.core.util.ReUtil;
-
-public class RegexUtil {
-
- public static boolean matches(CharSequence input, String regex) {
- return ReUtil.isMatch(regex, input);
- }
-
- public static boolean matches(CharSequence input, Pattern regex) {
- return ReUtil.isMatch(regex, input);
- }
-
- public static boolean matchesOr(CharSequence input, String... regexs) {
- boolean isMatched;
- for (String regex : regexs) {
- isMatched = matches(input, regex);
- if (isMatched) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean matchesOr(CharSequence input, Pattern... regexs) {
- boolean isMatched;
- for (Pattern regex : regexs) {
- isMatched = matches(input, regex);
- if (isMatched) {
- return true;
- }
- }
- return false;
- }
-
- public static boolean matchesAnd(CharSequence input, String... regexs) {
- boolean isMatched;
- for (String regex : regexs) {
- isMatched = matches(input, regex);
- if (!isMatched) {
- return false;
- }
- }
- return true;
- }
-
- public static boolean matchesAnd(CharSequence input, Pattern... regexs) {
- boolean isMatched;
- for (Pattern regex : regexs) {
- isMatched = matches(input, regex);
- if (!isMatched) {
- return false;
- }
- }
- return true;
- }
-
- private RegexUtil() {
- throw new IllegalStateException("Utility class");
- }
-}