refactor: 优化部分代码

修复 Sonar、Codacy 扫描问题
This commit is contained in:
2024-02-02 21:35:21 +08:00
parent dcb6568916
commit 4558cf004b
3 changed files with 207 additions and 8 deletions

View File

@@ -20,8 +20,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import top.charles7c.continew.starter.captcha.graphic.enums.GraphicCaptchaType;
import top.charles7c.continew.starter.core.constant.PropertiesConstants;
import java.awt.*;
/**
* 图形验证码配置属性
*

View File

@@ -24,9 +24,6 @@ package top.charles7c.continew.starter.core.constant;
*/
public class PropertiesConstants {
private PropertiesConstants() {
}
/**
* ContiNew Starter
*/
@@ -106,4 +103,7 @@ public class PropertiesConstants {
* 行为验证码配置
*/
public static final String CAPTCHA_BEHAVIOR = CAPTCHA + ".behavior";
private PropertiesConstants() {
}
}

View File

@@ -16,18 +16,216 @@
package top.charles7c.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 Charles7c
* @since 1.0.0
*/
public class StringConstants implements StrPool {
public class StringConstants {
private 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;
/**
* 字符常量:花括号(左) <code>'{'</code>
*/
public static final char C_DELIM_START = CharPool.DELIM_START;
/**
* 字符常量:花括号(右) <code>'}'</code>
*/
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 "\t"}
*/
public static final String TAB = StrPool.TAB;
/**
* 字符串常量:点 {@code "."}
*/
public static final String DOT = StrPool.DOT;
/**
* 字符串常量:双点 {@code ".."} <br>
* 用途:作为指向上级文件夹的路径,如:{@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"} <br>
* 解释:该字符常用于表示 Linux 系统和 MacOS 系统下的文本换行
*/
public static final String CR = StrPool.CR;
/**
* 字符串常量:换行符 {@code "\n"}
*/
public static final String LF = StrPool.LF;
/**
* 字符串常量Windows 换行 {@code "\r\n"} <br>
* 解释:该字符串常用于表示 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;
/**
* 字符串常量:花括号(左) <code>"{"</code>
*/
public static final String DELIM_START = StrPool.DELIM_START;
/**
* 字符串常量:花括号(右) <code>"}"</code>
*/
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 "&nbsp;" -> " "}
*/
public static final String HTML_NBSP = XmlUtil.NBSP;
/**
* 字符串常量HTML And 符转义 {@code "&amp;" -> "&"}
*/
public static final String HTML_AMP = XmlUtil.AMP;
/**
* 字符串常量HTML 双引号转义 {@code "&quot;" -> "\""}
*/
public static final String HTML_QUOTE = XmlUtil.QUOTE;
/**
* 字符串常量HTML 单引号转义 {@code "&apos" -> "'"}
*/
public static final String HTML_APOS = XmlUtil.APOS;
/**
* 字符串常量HTML 小于号转义 {@code "&lt;" -> "<"}
*/
public static final String HTML_LT = XmlUtil.LT;
/**
* 字符串常量HTML 大于号转义 {@code "&gt;" -> ">"}
*/
public static final String HTML_GT = XmlUtil.GT;
/**
* 字符串常量:空 JSON {@code "{}"}
*/
public static final String EMPTY_JSON = StrPool.EMPTY_JSON;
/**
* 空字符串
@@ -68,4 +266,7 @@ public class StringConstants implements StrPool {
* 路径模式(仅匹配当前目录)
*/
public static final String PATH_PATTERN_CURRENT_DIR = "/*";
private StringConstants() {
}
}