diff --git a/continew-starter-api-doc/src/main/java/top/continew/starter/apidoc/handler/BaseEnumParameterHandler.java b/continew-starter-api-doc/src/main/java/top/continew/starter/apidoc/handler/BaseEnumParameterHandler.java index 43ad077d..b13462ee 100644 --- a/continew-starter-api-doc/src/main/java/top/continew/starter/apidoc/handler/BaseEnumParameterHandler.java +++ b/continew-starter-api-doc/src/main/java/top/continew/starter/apidoc/handler/BaseEnumParameterHandler.java @@ -16,8 +16,8 @@ package top.continew.starter.apidoc.handler; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ClassUtil; -import cn.hutool.core.util.StrUtil; import com.fasterxml.jackson.databind.type.CollectionType; import com.fasterxml.jackson.databind.type.SimpleType; import io.swagger.v3.core.converter.AnnotatedType; @@ -52,7 +52,7 @@ public class BaseEnumParameterHandler implements ParameterCustomizer, PropertyCu return parameterModel; } String description = parameterModel.getDescription(); - if (StrUtil.contains(description, "color:red")) { + if (CharSequenceUtil.contains(description, "color:red")) { return parameterModel; } // 自定义枚举描述并封装参数配置 diff --git a/continew-starter-core/src/main/java/top/continew/starter/core/constant/CharConstants.java b/continew-starter-core/src/main/java/top/continew/starter/core/constant/CharConstants.java new file mode 100644 index 00000000..d19e2b71 --- /dev/null +++ b/continew-starter-core/src/main/java/top/continew/starter/core/constant/CharConstants.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.gnu.org/licenses/lgpl.html + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package top.continew.starter.core.constant;
+
+/**
+ * 字符相关常量
+ *
+ * @author looly(Hutool)
+ * @author Charles7c
+ * @see cn.hutool.core.text.CharPool
+ * @since 2.7.3
+ */
+public class CharConstants {
+
+ /**
+ * 空格符 {@code ' '}
+ */
+ public static final char SPACE = ' ';
+
+ /**
+ * 制表符 {@code '\t'}
+ */
+ public static final char TAB = ' ';
+
+ /**
+ * 点 {@code '.'}
+ */
+ public static final char DOT = '.';
+
+ /**
+ * 逗号 {@code ','}
+ */
+ public static final char COMMA = ',';
+
+ /**
+ * 中文逗号 {@code ','}
+ */
+ public static final char CHINESE_COMMA = ',';
+
+ /**
+ * 冒号 {@code ':'}
+ */
+ public static final char COLON = ':';
+
+ /**
+ * 分号 {@code ';'}
+ */
+ public static final char SEMICOLON = ';';
+
+ /**
+ * 问号 {@code '?'}
+ */
+ public static final char QUESTION_MARK = '?';
+
+ /**
+ * 下划线 {@code '_'}
+ */
+ public static final char UNDERLINE = '_';
+
+ /**
+ * 减号(连接符) {@code '-'}
+ */
+ public static final char DASHED = '-';
+
+ /**
+ * 星号 {@code '*'}
+ */
+ public static final char ASTERISK = '*';
+
+ /**
+ * 斜杠 {@code '/'}
+ */
+ public static final char SLASH = '/';
+
+ /**
+ * 反斜杠 {@code '\\'}
+ */
+ public static final char BACKSLASH = '\\';
+
+ /**
+ * 管道符 {@code '|'}
+ */
+ public static final char PIPE = '|';
+
+ /**
+ * 艾特 {@code '@'}
+ */
+ public static final char AT = '@';
+
+ /**
+ * 与符号 {@code '&'}
+ */
+ public static final char AMP = '&';
+
+ /**
+ * 花括号(左) '{'
+ */
+ public static final char DELIM_START = '{';
+
+ /**
+ * 花括号(右) '}'
+ */
+ public static final char DELIM_END = '}';
+
+ /**
+ * 中括号(左) {@code '['}
+ */
+ public static final char BRACKET_START = '[';
+
+ /**
+ * 中括号(右) {@code ']'}
+ */
+ public static final char BRACKET_END = ']';
+
+ /**
+ * 圆括号(左) {@code '('}
+ */
+ public static final char ROUND_BRACKET_START = '(';
+
+ /**
+ * 圆括号(右) {@code ')'}
+ */
+ public static final char ROUND_BRACKET_END = ')';
+
+ /**
+ * 双引号 {@code '"'}
+ */
+ public static final char DOUBLE_QUOTES = '"';
+
+ /**
+ * 单引号 {@code '\''}
+ */
+ public static final char SINGLE_QUOTE = '\'';
+
+ /**
+ * 等号 {@code '='}
+ */
+ public static final char EQUALS = '=';
+
+ /**
+ * 回车符 {@code '\r'}
+ */
+ public static final char CR = '\r';
+
+ /**
+ * 换行符 {@code '\n'}
+ */
+ public static final char LF = '\n';
+
+ private CharConstants() {
+ }
+}
diff --git a/continew-starter-core/src/main/java/top/continew/starter/core/constant/StringConstants.java b/continew-starter-core/src/main/java/top/continew/starter/core/constant/StringConstants.java
index a9527ee9..340378fa 100644
--- a/continew-starter-core/src/main/java/top/continew/starter/core/constant/StringConstants.java
+++ b/continew-starter-core/src/main/java/top/continew/starter/core/constant/StringConstants.java
@@ -16,253 +16,133 @@
package top.continew.starter.core.constant;
-import cn.hutool.core.text.CharPool;
-import cn.hutool.core.text.StrPool;
-import cn.hutool.core.util.XmlUtil;
-
/**
* 字符串相关常量
*
- * @author looly
+ * @author looly(Hutool)
* @author Charles7c
+ * @see cn.hutool.core.text.StrPool
* @since 1.0.0
*/
public class StringConstants {
/**
- * 字符常量:空格符 {@code ' '}
- */
- public static final char C_SPACE = CharPool.SPACE;
-
- /**
- * 字符常量:制表符 {@code '\t'}
- */
- public static final char C_TAB = CharPool.TAB;
-
- /**
- * 字符常量:点 {@code '.'}
- */
- public static final char C_DOT = CharPool.DOT;
-
- /**
- * 字符常量:斜杠 {@code '/'}
- */
- public static final char C_SLASH = CharPool.SLASH;
-
- /**
- * 字符常量:反斜杠 {@code '\\'}
- */
- public static final char C_BACKSLASH = CharPool.BACKSLASH;
-
- /**
- * 字符常量:回车符 {@code '\r'}
- */
- public static final char C_CR = CharPool.CR;
-
- /**
- * 字符常量:换行符 {@code '\n'}
- */
- public static final char C_LF = CharPool.LF;
-
- /**
- * 字符常量:下划线 {@code '_'}
- */
- public static final char C_UNDERLINE = CharPool.UNDERLINE;
-
- /**
- * 字符常量:逗号 {@code ','}
- */
- public static final char C_COMMA = CharPool.COMMA;
-
- /**
- * 字符常量:花括号(左) '{'
- */
- public static final char C_DELIM_START = CharPool.DELIM_START;
-
- /**
- * 字符常量:花括号(右) '}'
- */
- public static final char C_DELIM_END = CharPool.DELIM_END;
-
- /**
- * 字符常量:中括号(左) {@code '['}
- */
- public static final char C_BRACKET_START = CharPool.BRACKET_START;
-
- /**
- * 字符常量:中括号(右) {@code ']'}
- */
- public static final char C_BRACKET_END = CharPool.BRACKET_END;
-
- /**
- * 字符常量:冒号 {@code ':'}
- */
- public static final char C_COLON = CharPool.COLON;
-
- /**
- * 字符常量:艾特 {@code '@'}
- */
- public static final char C_AT = CharPool.AT;
-
- /**
- * 字符常量:星号 {@code '*'}
- */
- public static final char C_ASTERISK = '*';
-
- /**
- * 字符串常量:制表符 {@code "\t"}
- */
- public static final String TAB = StrPool.TAB;
-
- /**
- * 字符串常量:点 {@code "."}
- */
- public static final String DOT = StrPool.DOT;
-
- /**
- * 字符串常量:双点 {@code ".."}
用途:作为指向上级文件夹的路径,如:{@code "../path"}
- */
- public static final String DOUBLE_DOT = StrPool.DOUBLE_DOT;
-
- /**
- * 字符串常量:斜杠 {@code "/"}
- */
- public static final String SLASH = StrPool.SLASH;
-
- /**
- * 字符串常量:反斜杠 {@code "\\"}
- */
- public static final String BACKSLASH = StrPool.BACKSLASH;
-
- /**
- * 字符串常量:回车符 {@code "\r"}
解释:该字符常用于表示 Linux 系统和 MacOS 系统下的文本换行
- */
- public static final String CR = StrPool.CR;
-
- /**
- * 字符串常量:换行符 {@code "\n"}
- */
- public static final String LF = StrPool.LF;
-
- /**
- * 字符串常量:Windows 换行 {@code "\r\n"}
解释:该字符串常用于表示 Windows 系统下的文本换行
- */
- public static final String CRLF = StrPool.CRLF;
-
- /**
- * 字符串常量:下划线 {@code "_"}
- */
- public static final String UNDERLINE = StrPool.UNDERLINE;
-
- /**
- * 字符串常量:减号(连接符) {@code "-"}
- */
- public static final String DASHED = StrPool.DASHED;
-
- /**
- * 字符串常量:逗号 {@code ","}
- */
- public static final String COMMA = StrPool.COMMA;
-
- /**
- * 字符串常量:花括号(左) "{"
- */
- public static final String DELIM_START = StrPool.DELIM_START;
-
- /**
- * 字符串常量:花括号(右) "}"
- */
- public static final String DELIM_END = StrPool.DELIM_END;
-
- /**
- * 字符串常量:中括号(左) {@code "["}
- */
- public static final String BRACKET_START = StrPool.BRACKET_START;
-
- /**
- * 字符串常量:中括号(右) {@code "]"}
- */
- public static final String BRACKET_END = StrPool.BRACKET_END;
-
- /**
- * 字符串常量:冒号 {@code ":"}
- */
- public static final String COLON = StrPool.COLON;
-
- /**
- * 字符串常量:艾特 {@code "@"}
- */
- public static final String AT = StrPool.AT;
-
- /**
- * 字符串常量:HTML 不间断空格转义 {@code " " -> " "}
- */
- public static final String HTML_NBSP = XmlUtil.NBSP;
-
- /**
- * 字符串常量:HTML And 符转义 {@code "&" -> "&"}
- */
- public static final String HTML_AMP = XmlUtil.AMP;
-
- /**
- * 字符串常量:HTML 双引号转义 {@code """ -> "\""}
- */
- public static final String HTML_QUOTE = XmlUtil.QUOTE;
-
- /**
- * 字符串常量:HTML 单引号转义 {@code "&apos" -> "'"}
- */
- public static final String HTML_APOS = XmlUtil.APOS;
-
- /**
- * 字符串常量:HTML 小于号转义 {@code "<" -> "<"}
- */
- public static final String HTML_LT = XmlUtil.LT;
-
- /**
- * 字符串常量:HTML 大于号转义 {@code ">" -> ">"}
- */
- public static final String HTML_GT = XmlUtil.GT;
-
- /**
- * 字符串常量:空 JSON {@code "{}"}
- */
- public static final String EMPTY_JSON = StrPool.EMPTY_JSON;
-
- /**
- * 空字符串
+ * 空字符串 {@code ""}
*/
public static final String EMPTY = "";
/**
- * 空格
+ * 空格符 {@code " "}
*/
public static final String SPACE = " ";
/**
- * 分号
+ * 制表符 {@code "\t"}
+ */
+ public static final String TAB = " ";
+
+ /**
+ * 空 JSON {@code "{}"}
+ */
+ public static final String EMPTY_JSON = "{}";
+
+ /**
+ * 点 {@code "."}
+ */
+ public static final String DOT = ".";
+
+ /**
+ * 双点 {@code ".."}
+ *
+ * 作为指向上级文件夹的路径,如:{@code "../path"} + *
+ */ + public static final String DOUBLE_DOT = ".."; + + /** + * 逗号 {@code ","} + */ + public static final String COMMA = ","; + + /** + * 中文逗号 {@code ","} + */ + public static final String CHINESE_COMMA = ","; + + /** + * 冒号 {@code ":"} + */ + public static final String COLON = ":"; + + /** + * 分号 {@code ";"} */ public static final String SEMICOLON = ";"; /** - * 星号 - */ - public static final String ASTERISK = "*"; - - /** - * 问号 + * 问号 {@code "?"} */ public static final String QUESTION_MARK = "?"; /** - * 管道符 + * 下划线 {@code "_"} + */ + public static final String UNDERLINE = "_"; + + /** + * 减号(连接符) {@code "-"} + */ + public static final String DASHED = "-"; + + /** + * 星号 {@code "*"} + */ + public static final String ASTERISK = "*"; + + /** + * 斜杠 {@code "/"} + */ + public static final String SLASH = "/"; + + /** + * 反斜杠 {@code "\\"} + */ + public static final String BACKSLASH = "\\"; + + /** + * 管道符 {@code "|"} */ public static final String PIPE = "|"; /** - * 中文逗号 + * 艾特 {@code "@"} */ - public static final String CHINESE_COMMA = ","; + public static final String AT = "@"; + + /** + * 与符号 {@code "&"} + */ + public static final String AMP = "&"; + + /** + * 花括号(左)"{"
+ */
+ public static final String DELIM_START = "{";
+
+ /**
+ * 花括号(右) "}"
+ */
+ public static final String DELIM_END = "}";
+
+ /**
+ * 中括号(左) {@code "["}
+ */
+ public static final String BRACKET_START = "[";
+
+ /**
+ * 中括号(右) {@code "]"}
+ */
+ public static final String BRACKET_END = "]";
/**
* 圆括号(左) {@code "("}
@@ -275,20 +155,70 @@ public class StringConstants {
public static final String ROUND_BRACKET_END = ")";
/**
- * 等号(=)
+ * 双引号 {@code "\""}
+ */
+ public static final String DOUBLE_QUOTES = "\"";
+
+ /**
+ * 单引号 {@code "'"}
+ */
+ public static final String SINGLE_QUOTE = "'";
+
+ /**
+ * 等号 {@code "="}
*/
public static final String EQUALS = "=";
/**
- * 路径模式
+ * 回车符 {@code "\r"}
+ */
+ public static final String CR = "\r";
+
+ /**
+ * 换行符 {@code "\n"}
+ */
+ public static final String LF = "\n";
+
+ /**
+ * 路径模式 {@code "/**"}
*/
public static final String PATH_PATTERN = "/**";
/**
- * 路径模式(仅匹配当前目录)
+ * 路径模式(仅匹配当前目录) {@code "/*"}
*/
public static final String PATH_PATTERN_CURRENT_DIR = "/*";
+ /**
+ * HTML 不间断空格转义 {@code " " -> " "}
+ */
+ public static final String HTML_NBSP = " ";
+
+ /**
+ * HTML And 符转义 {@code "&" -> "&"}
+ */
+ public static final String HTML_AMP = "&";
+
+ /**
+ * HTML 双引号转义 {@code """ -> "\""}
+ */
+ public static final String HTML_QUOTE = """;
+
+ /**
+ * HTML 单引号转义 {@code "&apos" -> "'"}
+ */
+ public static final String HTML_APOS = "'";
+
+ /**
+ * HTML 小于号转义 {@code "<" -> "<"}
+ */
+ public static final String HTML_LT = "<";
+
+ /**
+ * HTML 大于号转义 {@code ">" -> ">"}
+ */
+ public static final String HTML_GT = ">";
+
private StringConstants() {
}
}
diff --git a/continew-starter-data/continew-starter-data-mf/src/main/java/top/continew/starter/data/mf/datapermission/DataPermissionDialect.java b/continew-starter-data/continew-starter-data-mf/src/main/java/top/continew/starter/data/mf/datapermission/DataPermissionDialect.java
index 579a4079..f505885b 100644
--- a/continew-starter-data/continew-starter-data-mf/src/main/java/top/continew/starter/data/mf/datapermission/DataPermissionDialect.java
+++ b/continew-starter-data/continew-starter-data-mf/src/main/java/top/continew/starter/data/mf/datapermission/DataPermissionDialect.java
@@ -16,7 +16,7 @@
package top.continew.starter.data.mf.datapermission;
-import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.text.CharSequenceUtil;
import com.mybatisflex.core.dialect.impl.CommonsDialectImpl;
import com.mybatisflex.core.query.QueryWrapper;
@@ -152,7 +152,7 @@ public class DataPermissionDialect extends CommonsDialectImpl {
* @return 带表别名字段
*/
private String buildColumn(String tableAlias, String columnName) {
- if (StrUtil.isNotEmpty(tableAlias)) {
+ if (CharSequenceUtil.isNotEmpty(tableAlias)) {
return "%s.%s".formatted(tableAlias, columnName);
}
return columnName;
diff --git a/continew-starter-security/continew-starter-security-mask/src/main/java/top/continew/starter/security/mask/annotation/JsonMask.java b/continew-starter-security/continew-starter-security-mask/src/main/java/top/continew/starter/security/mask/annotation/JsonMask.java
index 7ae13684..17687b7d 100644
--- a/continew-starter-security/continew-starter-security-mask/src/main/java/top/continew/starter/security/mask/annotation/JsonMask.java
+++ b/continew-starter-security/continew-starter-security-mask/src/main/java/top/continew/starter/security/mask/annotation/JsonMask.java
@@ -18,7 +18,7 @@ package top.continew.starter.security.mask.annotation;
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import top.continew.starter.core.constant.StringConstants;
+import top.continew.starter.core.constant.CharConstants;
import top.continew.starter.security.mask.core.JsonMaskSerializer;
import top.continew.starter.security.mask.enums.MaskType;
import top.continew.starter.security.mask.strategy.IMaskStrategy;
@@ -72,5 +72,5 @@ public @interface JsonMask {
/**
* 脱敏符号(默认:*)
*/
- char character() default StringConstants.C_ASTERISK;
+ char character() default CharConstants.ASTERISK;
}
\ No newline at end of file