refactor(core): 拆分字符串常量和字符常量

This commit is contained in:
2024-11-15 21:54:06 +08:00
parent c7bee0033e
commit 2e9079a909
5 changed files with 322 additions and 226 deletions

View File

@@ -0,0 +1,166 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
* <p>
* 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
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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<a href="https://gitee.com/dromara/hutool">Hutool</a>
* @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 = '&';
/**
* 花括号(左) <code>'{'</code>
*/
public static final char DELIM_START = '{';
/**
* 花括号(右) <code>'}'</code>
*/
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() {
}
}

View File

@@ -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<a href="https://gitee.com/dromara/hutool">Hutool</a>
* @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;
/**
* 字符常量:花括号(左) <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 '*'}
*/
public static final char C_ASTERISK = '*';
/**
* 字符串常量:制表符 {@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;
/**
* 空字符串
* 字符 {@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 ".."}
* <p>
* 作为指向上级文件夹的路径,如:{@code "../path"}
* </p>
*/
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 = "&";
/**
* 花括号(左) <code>"{"</code>
*/
public static final String DELIM_START = "{";
/**
* 花括号(右) <code>"}"</code>
*/
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 "&nbsp;" -> " "}
*/
public static final String HTML_NBSP = "&nbsp;";
/**
* HTML And 符转义 {@code "&amp;" -> "&"}
*/
public static final String HTML_AMP = "&amp;";
/**
* HTML 双引号转义 {@code "&quot;" -> "\""}
*/
public static final String HTML_QUOTE = "&quot;";
/**
* HTML 单引号转义 {@code "&apos" -> "'"}
*/
public static final String HTML_APOS = "&apos;";
/**
* HTML 小于号转义 {@code "&lt;" -> "<"}
*/
public static final String HTML_LT = "&lt;";
/**
* HTML 大于号转义 {@code "&gt;" -> ">"}
*/
public static final String HTML_GT = "&gt;";
private StringConstants() {
}
}