【优化】统一字符校验名字

This commit is contained in:
wxd-gaming
2025-02-17 13:21:39 +08:00
parent 18775c395c
commit 9fbedd973e
60 changed files with 214 additions and 217 deletions

View File

@@ -25,7 +25,7 @@ import wxdgaming.boot.batis.DbConfig;
import wxdgaming.boot.batis.EntityField;
import wxdgaming.boot.batis.struct.DataChecked;
import wxdgaming.boot.core.append.StreamWriter;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.system.MarkTimer;
import wxdgaming.boot.core.timer.MyClock;
@@ -119,7 +119,7 @@ public class MongoDataHelper extends DataHelper<MongoEntityTable, MongoDataWrapp
clientSession.close();
mongoDatabase = mongoClient.getDatabase(dbConfig.getDbBase());
if (StringUtil.notEmptyOrNull(getDbConfig().getScanPackage())) {
if (StringUtils.isNotBlank(getDbConfig().getScanPackage())) {
checkDataBase(getDbConfig().getScanPackage());
}

View File

@@ -7,7 +7,7 @@ import wxdgaming.boot.batis.DbConfig;
import wxdgaming.boot.batis.sql.SqlDataHelper;
import wxdgaming.boot.batis.sql.SqlDataWrapper;
import wxdgaming.boot.batis.sql.SqlEntityTable;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.sql.Connection;
@@ -54,7 +54,7 @@ public class MysqlDataHelper extends SqlDataHelper<SqlEntityTable, SqlDataWrappe
if (getDbConfig().isCreateDbBase()) {
createDatabase();
}
if (StringUtil.notEmptyOrNull(getDbConfig().getScanPackage())) {
if (StringUtils.isNotBlank(getDbConfig().getScanPackage())) {
checkDataBase(getDbConfig().getScanPackage());
}
if (dbConfig.isConnectionPool()) {

View File

@@ -7,13 +7,11 @@ import wxdgaming.boot.batis.DbConfig;
import wxdgaming.boot.batis.EntityField;
import wxdgaming.boot.batis.sql.SqlDataHelper;
import wxdgaming.boot.batis.sql.SqlDataWrapper;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.timer.MyClock;
import wxdgaming.boot.core.str.StringUtils;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -58,7 +56,7 @@ public class PgsqlDataHelper extends SqlDataHelper<PgsqlEntityTable, SqlDataWrap
if (getDbConfig().isCreateDbBase()) {
createDatabase();
}
if (StringUtil.notEmptyOrNull(getDbConfig().getScanPackage())) {
if (StringUtils.isNotBlank(getDbConfig().getScanPackage())) {
checkDataBase(getDbConfig().getScanPackage());
}

View File

@@ -8,7 +8,7 @@ import wxdgaming.boot.batis.sql.SqlDataHelper;
import wxdgaming.boot.batis.sql.SqlDataWrapper;
import wxdgaming.boot.batis.sql.SqlEntityTable;
import wxdgaming.boot.core.append.StreamWriter;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.sql.Connection;
import java.sql.SQLException;
@@ -56,7 +56,7 @@ public class SqliteDataHelper extends SqlDataHelper<SqlEntityTable, SqlDataWrapp
this.startEnd = true;
}
if (StringUtil.notEmptyOrNull(getDbConfig().getScanPackage())) {
if (StringUtils.isNotBlank(getDbConfig().getScanPackage())) {
checkDataBase(getDbConfig().getScanPackage());
}

View File

@@ -2,7 +2,7 @@ package wxdgaming.boot.batis.sql;
import wxdgaming.boot.agent.function.PredicateE;
import wxdgaming.boot.core.lang.Tuple2;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.util.LinkedList;
import java.util.List;
@@ -48,7 +48,7 @@ interface SqlSelect<DM extends SqlEntityTable, DW extends SqlDataWrapper<DM>> ex
/** 获取现有数据量 */
default long rowCount(String tableName, String whereSqlString, Object... args) {
String sqlString = "select count(1) usm from " + tableName;
if (StringUtil.notEmptyOrNull(whereSqlString)) {
if (StringUtils.isNotBlank(whereSqlString)) {
sqlString += " where " + whereSqlString;
}
return this.executeScalar(sqlString, long.class, args);

View File

@@ -7,7 +7,7 @@ import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.GlobalUtil;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.core.collection.ConvertCollection;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.system.MarkTimer;
import wxdgaming.boot.core.threading.Event;
import wxdgaming.boot.core.threading.Executors;
@@ -84,7 +84,7 @@ public abstract class BatchPool implements AutoCloseable {
if (threads.length >= 1) {
/*批量入库的时候根据主键hash数据*/
final Object fieldValue = entityTable.getDataColumnKey().getFieldValue(obj);
index = StringUtil.hashIndex(fieldValue, true, threads.length);
index = StringUtils.hashIndex(fieldValue, true, threads.length);
}
Map<EntityField, Object> map = dataBuilder().toDbMap(obj);
return new DataBuilder(index, tableName, obj, entityTable, map);

View File

@@ -14,7 +14,7 @@ import wxdgaming.boot.core.field.FieldMapping;
import wxdgaming.boot.core.lang.ConvertUtil;
import wxdgaming.boot.core.lang.LoggerException;
import wxdgaming.boot.core.str.PatternStringUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import java.io.Serializable;
@@ -99,7 +99,7 @@ public abstract class DataWrapper<DM extends EntityTable>
// 判断指定类型的注释是否存在于此元素上
DbTable annotation = AnnUtil.ann(clazz, DbTable.class, true);
// 拿到对应的表格注解类型
if (annotation == null || StringUtil.emptyOrNull(annotation.name())) {
if (annotation == null || StringUtils.isBlank(annotation.name())) {
return clazz.getSimpleName().trim().toLowerCase();// 不存在就不需要获取其表名
} else {
return annotation.name().trim().toLowerCase();// 返回注解中的值,也就是表名
@@ -121,7 +121,7 @@ public abstract class DataWrapper<DM extends EntityTable>
public String columnName(Field field, DbColumn dbColumn) {
String fieldName = field.getName();
if (dbColumn != null) {
if (StringUtil.notEmptyOrNull(dbColumn.name()))
if (StringUtils.isNotBlank(dbColumn.name()))
fieldName = dbColumn.name();
}
return fieldName;
@@ -182,7 +182,7 @@ public abstract class DataWrapper<DM extends EntityTable>
entityTable.setSplitNumber(dbTable.splitTable());
}
if (StringUtil.notEmptyOrNull(tableComment)) {
if (StringUtils.isNotBlank(tableComment)) {
entityTable.setTableComment(tableComment);
}
@@ -228,7 +228,7 @@ public abstract class DataWrapper<DM extends EntityTable>
entityField.setColumnComment("");
if (dbColumn != null) {
if (StringUtil.notEmptyOrNull(dbColumn.comment())) {
if (StringUtils.isNotBlank(dbColumn.comment())) {
entityField.setColumnComment(dbColumn.comment().trim());
}

View File

@@ -7,7 +7,7 @@ import lombok.Setter;
import wxdgaming.boot.batis.enums.ColumnType;
import wxdgaming.boot.batis.enums.SortType;
import wxdgaming.boot.core.field.FieldMapping;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.util.Objects;
@@ -66,7 +66,7 @@ public class EntityField extends FieldMapping {
String[] s = tmp.split("[_-]");
if (s.length > 1) {
for (int i = 1; i < s.length; i++) {
s[i] = StringUtil.upperFirst(s[i]);
s[i] = StringUtils.upperFirst(s[i]);
}
}
return String.join("", s);

View File

@@ -8,7 +8,7 @@ import lombok.experimental.Accessors;
import wxdgaming.boot.batis.struct.DbIndex;
import wxdgaming.boot.batis.struct.TableName;
import wxdgaming.boot.core.append.StreamWriter;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.Serializable;
import java.util.Collection;
@@ -100,12 +100,12 @@ public class EntityTable implements Serializable, DbIndex {
String[] split = tableName.split("_|-");
if (split.length > 1) {
for (int i = 1; i < split.length; i++) {
split[i] = StringUtil.upperFirst(split[i]);
split[i] = StringUtils.upperFirst(split[i]);
}
}
String codeName = String.join("", split);
return StringUtil.upperFirst(codeName);
return StringUtils.upperFirst(codeName);
}
/**

View File

@@ -7,7 +7,7 @@ import wxdgaming.boot.core.str.TemplatePack;
import wxdgaming.boot.batis.EntityField;
import wxdgaming.boot.batis.EntityTable;
import wxdgaming.boot.core.append.StreamWriter;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.File;
import java.io.Serializable;
@@ -95,7 +95,7 @@ public class CreateCSharpCode implements Serializable, ICreateCode {
streamWriter.write(fieldTypeString);
streamWriter
.write(" ").write(StringUtil.upperFirst(column.getFieldName())).write(" { get; set; }").writeLn();
.write(" ").write(StringUtils.upperFirst(column.getFieldName())).write(" { get; set; }").writeLn();
}
streamWriter
@@ -132,7 +132,7 @@ public class CreateCSharpCode implements Serializable, ICreateCode {
protected byte[] createCodeFactory(EntityTable entityTable, String packageName) {
StreamWriter streamWriter = new StreamWriter();
final EntityField dataColumnKey = entityTable.getDataColumnKey();
final String keyFieldName = StringUtil.upperFirst(dataColumnKey.getFieldName());
final String keyFieldName = StringUtils.upperFirst(dataColumnKey.getFieldName());
final String KeyFieldTypeString = dataColumnKey.getFieldTypeString();
streamWriter
.write("using System;\n")

View File

@@ -5,7 +5,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.File;
import java.io.FileInputStream;
@@ -22,7 +22,7 @@ public class Excel implements Serializable {
private static final long serialVersionUID = 1L;
protected final Workbook builderWorkbook(File file) {
if (file == null || StringUtil.emptyOrNull(file.getName()) || file.getName().contains("@") || file.getName().contains("$")) {
if (file == null || StringUtils.isBlank(file.getName()) || file.getName().contains("@") || file.getName().contains("$")) {
log.info("Excel文件不能解析" + file.getPath());
return null;
}

View File

@@ -15,7 +15,7 @@ import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.field.ClassMapping;
import wxdgaming.boot.core.field.ClassWrapper;
import wxdgaming.boot.core.lang.ConvertUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.TemplatePack;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.system.MarkTimer;
@@ -111,11 +111,11 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
Sheet sheet = workbook.getSheetAt(i);
String sheetName = sheet.getSheetName().trim().toLowerCase();
if (StringUtil.emptyOrNull(sheetName)
|| sheetName.startsWith("sheet")
|| sheetName.contains("@")
|| sheetName.contains("$")
|| !sheetName.startsWith("q_")) {
if (StringUtils.isBlank(sheetName)
|| sheetName.startsWith("sheet")
|| sheetName.contains("@")
|| sheetName.contains("$")
|| !sheetName.startsWith("q_")) {
log.debug("Excel文件不能解析{}, sheetName={} - 需要是 q_ 开头 sheet name 才能解析", excelFile, sheetName);
continue;
}
@@ -202,14 +202,14 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
String cellName = getCellString(cellDataName, true);
String cellExtend = getCellString(cellDataExtend, false);
if (StringUtil.emptyOrNull(cellName)
|| StringUtil.emptyOrNull(cellType)
|| "no".equalsIgnoreCase(cellExtend)) {
if (StringUtils.isBlank(cellName)
|| StringUtils.isBlank(cellType)
|| "no".equalsIgnoreCase(cellExtend)) {
return;
}
if (StringUtil.notEmptyOrNull(cellExtend) && !"all".equalsIgnoreCase(cellExtend)) {
if (StringUtil.notEmptyOrNull(haveExtend) && !haveExtend.equalsIgnoreCase(cellExtend)) {
if (StringUtils.isNotBlank(cellExtend) && !"all".equalsIgnoreCase(cellExtend)) {
if (StringUtils.isNotBlank(haveExtend) && !haveExtend.equalsIgnoreCase(cellExtend)) {
return;
}
}
@@ -265,7 +265,7 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
Sheet sheet = workbook.getSheetAt(i);
String sheetName = sheet.getSheetName().trim().toLowerCase();
if (StringUtil.emptyOrNull(sheetName)) {
if (StringUtils.isBlank(sheetName)) {
continue;
}
@@ -293,7 +293,7 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
boolean nullRow = true;
for (int c = 0; c < lastCellNum; c++) {
Cell rowCellData = row.getCell(c);
if (StringUtil.notEmptyOrNull(getCellString(rowCellData, false))) {
if (StringUtils.isNotBlank(getCellString(rowCellData, false))) {
nullRow = false;
}
}
@@ -308,8 +308,8 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
/*数据映射名字*/
String cellName = getCellString(rowDataName.getCell(c), true);
if (StringUtil.emptyOrNull(cellType)
|| StringUtil.emptyOrNull(cellName)) {
if (StringUtils.isBlank(cellType)
|| StringUtils.isBlank(cellName)) {
/*忽略字段*/
continue;
}
@@ -330,7 +330,7 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
rowMap.put(column, value);
if (value != null) {
final String valueOf = String.valueOf(value);
if (!"0".equalsIgnoreCase(valueOf) && StringUtil.notEmptyOrNull(valueOf))
if (!"0".equalsIgnoreCase(valueOf) && StringUtils.isNotBlank(valueOf))
checkAllCellNull = false;
}
}
@@ -703,7 +703,7 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
}
boolean notNullOrEmpty(String source) {
if (StringUtil.notEmptyOrNull(source)) {
if (StringUtils.isNotBlank(source)) {
if (!"#null".equalsIgnoreCase(source)) {
return true;
}
@@ -728,15 +728,15 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
/*字符类型*/
trim = data.getStringCellValue().trim();
}
if (StringUtil.emptyOrNull(trim)) {
if (StringUtils.isBlank(trim)) {
trim = data.toString().trim();
}
}
if (StringUtil.notEmptyOrNull(trim)) {
if (StringUtils.isNotBlank(trim)) {
trim = trim.replace("class", "clazz")
.replace("-", "_");
if (isColumnName) {
trim = StringUtil.lowerFirst(trim);
trim = StringUtils.lowerFirst(trim);
}
}
return trim.trim();
@@ -820,8 +820,8 @@ public abstract class ExcelRead<DM extends EntityTable, DW extends DataWrapper<D
for (EntityField field : entityTable.getColumnMap().values()) {
ClassMapping wrapper = ClassWrapper.wrapper(field.getClass());
Map<String, Object> column = wrapper.toMap(field);
column.put("fieldNameLower", StringUtil.lowerFirst(field.getFieldName()));
column.put("fieldNameUpper", StringUtil.upperFirst(field.getFieldName()));
column.put("fieldNameLower", StringUtils.lowerFirst(field.getFieldName()));
column.put("fieldNameUpper", StringUtils.upperFirst(field.getFieldName()));
columns.add(column);
}
parse.put("columns", columns);

View File

@@ -1,7 +1,7 @@
package wxdgaming.boot.batis.save;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import java.util.Map;
@@ -44,7 +44,7 @@ public interface CheckSaveCode {
* @return
*/
default boolean checkSaveCode(String key, String saveStr) {
return checkSaveCode(key, StringUtil.hashcode(saveStr));
return checkSaveCode(key, StringUtils.hashcode(saveStr));
}

View File

@@ -6,7 +6,7 @@ import wxdgaming.boot.agent.system.ReflectContext;
import wxdgaming.boot.batis.DataWrapper;
import wxdgaming.boot.batis.EntityTable;
import wxdgaming.boot.batis.struct.DbBean;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.Serializable;
import java.util.Collection;
@@ -155,10 +155,10 @@ public abstract class DataRepository<DM extends EntityTable, DW extends DataWrap
protected void addReloadMsg(StringBuilder out, DM entityTable, DbBean<?, ?> dbBean) {
if (out != null) {
out
.append("|").append(StringUtil.padRight(String.valueOf(dbBean.dbSize()), 10, ' ')).append("\t")
.append("|").append(StringUtil.padRight(entityTable.getTableName(), 40, ' ')).append("\t")
.append("|").append(StringUtil.padRight(entityTable.getEntityClass().getSimpleName(), 40, ' ')).append("\t")
.append("|").append(StringUtil.padRight(entityTable.getTableComment(), 60, ' ')).append("\t")
.append("|").append(StringUtils.padRight(String.valueOf(dbBean.dbSize()), 10, ' ')).append("\t")
.append("|").append(StringUtils.padRight(entityTable.getTableName(), 40, ' ')).append("\t")
.append("|").append(StringUtils.padRight(entityTable.getEntityClass().getSimpleName(), 40, ' ')).append("\t")
.append("|").append(StringUtils.padRight(entityTable.getTableComment(), 60, ' ')).append("\t")
.append("\n");
}
}
@@ -170,10 +170,10 @@ public abstract class DataRepository<DM extends EntityTable, DW extends DataWrap
}
out
.append("|").append(StringUtil.padRight("读取数量", 10, ' ')).append("\t")
.append("|").append(StringUtil.padRight("映射表名", 40, ' ')).append("\t")
.append("|").append(StringUtil.padRight("映射类名", 40, ' ')).append("\t")
.append("|").append(StringUtil.padRight("映射备注", 60, ' ')).append("\t")
.append("|").append(StringUtils.padRight("读取数量", 10, ' ')).append("\t")
.append("|").append(StringUtils.padRight("映射表名", 40, ' ')).append("\t")
.append("|").append(StringUtils.padRight("映射类名", 40, ' ')).append("\t")
.append("|").append(StringUtils.padRight("映射备注", 60, ' ')).append("\t")
.append("\n");
if (type == 2) {

View File

@@ -2,7 +2,7 @@ package wxdgaming.boot.batis.struct;
import wxdgaming.boot.batis.EntityField;
import wxdgaming.boot.batis.EntityTable;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
/**
* @author: wxd-gaming(無心道, 15388152619)
@@ -24,10 +24,10 @@ public interface DbIndex {
} else if (fieldValue instanceof Long) {
hashcode = (Long) fieldValue;
} else {
hashcode = StringUtil.hashcode(fieldValue.toString(), true);
hashcode = StringUtils.hashcode(fieldValue.toString(), true);
}
/*采用双重冗余 hash 捅 分配数据 插槽 3.8 这个因子不能改*/
int index = StringUtil.hashIndex(hashcode, splitNumber);
int index = StringUtils.hashIndex(hashcode, splitNumber);
return index;
}

View File

@@ -2,7 +2,7 @@ package wxdgaming.boot.core.append;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
@@ -98,8 +98,8 @@ public class StreamWriter implements Closeable, AutoCloseable {
* @return
*/
public StreamWriter write(Object append, Charset charsetName) {
if (append == null || StringUtil.nullStr.equals(append)) {
write(StringUtil.nullBytes);
if (append == null || StringUtils.nullStr.equals(append)) {
write(StringUtils.nullBytes);
} else if (append instanceof byte[]) {
write((byte[]) append);
} else {
@@ -155,7 +155,7 @@ public class StreamWriter implements Closeable, AutoCloseable {
* @return
*/
public StreamWriter writeLeft(Object src, int len, char ch) {
write(StringUtil.padLeft(String.valueOf(src), len, ch));
write(StringUtils.padLeft(String.valueOf(src), len, ch));
return this;
}
@@ -168,7 +168,7 @@ public class StreamWriter implements Closeable, AutoCloseable {
* @return
*/
public StreamWriter writeRight(Object src, int len, char ch) {
write(StringUtil.padRight(String.valueOf(src), len, ch));
write(StringUtils.padRight(String.valueOf(src), len, ch));
return this;
}
@@ -176,7 +176,7 @@ public class StreamWriter implements Closeable, AutoCloseable {
* 增加换行符
*/
public StreamWriter writeLn() {
write(StringUtil.LineBytes);
write(StringUtils.LineBytes);
return this;
}

View File

@@ -5,7 +5,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import wxdgaming.boot.core.lang.ConvertUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.Serializable;
@@ -68,13 +68,13 @@ public class ByteFormat implements Serializable {
long g = m / 1024;
m = m % 1024;
if (g > 0)
stringBuilder.append(StringUtil.padLeft(g, 4, ' ')).append(" G, ");
stringBuilder.append(StringUtils.padLeft(g, 4, ' ')).append(" G, ");
if (m > 0)
stringBuilder.append(StringUtil.padLeft(m, 4, ' ')).append(" M, ");
stringBuilder.append(StringUtils.padLeft(m, 4, ' ')).append(" M, ");
if (k > 0)
stringBuilder.append(StringUtil.padLeft(k, 4, ' ')).append(" K, ");
stringBuilder.append(StringUtils.padLeft(k, 4, ' ')).append(" K, ");
if (b > 0)
stringBuilder.append(StringUtil.padLeft(b, 4, ' ') + " B");
stringBuilder.append(StringUtils.padLeft(b, 4, ' ') + " B");
}
private void formatInfo(FormatInfo formatInfo, StringBuilder stringBuilder) {
@@ -82,7 +82,7 @@ public class ByteFormat implements Serializable {
if (formatInfo != FormatInfo.B) {
obj = ConvertUtil.float2(allBytes / formatInfo.getCode());
}
stringBuilder.append(StringUtil.padLeft(obj, 12, ' ')).append(" ").append(formatInfo.getComment());
stringBuilder.append(StringUtils.padLeft(obj, 12, ' ')).append(" ").append(formatInfo.getComment());
}
public void toString(FormatInfo formatInfo, StringBuilder stringBuilder) {

View File

@@ -5,7 +5,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import wxdgaming.boot.core.lang.ConvertUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.Serializable;
@@ -94,7 +94,7 @@ public class TimeFormat implements Serializable {
if (formatInfo != FormatInfo.MS) {
obj = ConvertUtil.float2(allTime / 100 / formatInfo.getCode());
}
stringBuilder.append(StringUtil.padLeft(obj, 12, ' ')).append(" ").append(formatInfo.getComment());
stringBuilder.append(StringUtils.padLeft(obj, 12, ' ')).append(" ").append(formatInfo.getComment());
}
public void toString(FormatInfo formatInfo, StringBuilder stringBuilder) {

View File

@@ -10,7 +10,7 @@ import lombok.Setter;
import lombok.experimental.Accessors;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import javax.imageio.ImageIO;
import java.awt.*;
@@ -99,7 +99,7 @@ public class QRCodeBox {
public void buildImage() {
try {
if (StringUtil.emptyOrNull(content)) throw new RuntimeException("二维码内容空");
if (StringUtils.isBlank(content)) throw new RuntimeException("二维码内容空");
HashMap<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); // 指定编码方式,避免中文乱码
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); // 指定纠错等级 如果二维码里面的内容比较多的话推荐使用H 容错率30% 这样可以避免一些扫描不出来的问题

View File

@@ -1,6 +1,6 @@
package wxdgaming.boot.core.lang;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import java.math.BigDecimal;
@@ -141,7 +141,7 @@ public class ConvertUtil {
if (obj == null) {
return null;
}
if (StringUtil.emptyOrNull(obj.toString())) {
if (StringUtils.isBlank(obj.toString())) {
return defaultValue(clazz);
}
if (clazz.isInstance(obj) || clazz.isAssignableFrom(obj.getClass())) {

View File

@@ -1,7 +1,7 @@
package wxdgaming.boot.core.lang.bit;
import lombok.Getter;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.Serializable;
import java.util.Arrays;
@@ -277,8 +277,8 @@ public class BitFlag implements Serializable {
String show = "";
if (longs != null) {
for (Long aLong : longs) {
show = toBinaryString("", StringUtil.padLeft(Long.toBinaryString(aLong), 64, '0'))
+ (StringUtil.emptyOrNull(show) ? "" : "_")
show = toBinaryString("", StringUtils.padLeft(Long.toBinaryString(aLong), 64, '0'))
+ (StringUtils.isBlank(show) ? "" : "_")
+ show;
}
}
@@ -294,17 +294,17 @@ public class BitFlag implements Serializable {
}
public static String toString(short i) {
String string = StringUtil.padLeft(Integer.toBinaryString(i), 16, '0');
String string = StringUtils.padLeft(Integer.toBinaryString(i), 16, '0');
return toBinaryString("0b", string);
}
public static String toString(int i) {
String string = StringUtil.padLeft(Integer.toBinaryString(i), 32, '0');
String string = StringUtils.padLeft(Integer.toBinaryString(i), 32, '0');
return toBinaryString("0b", string);
}
public static String toString(long l) {
String string = StringUtil.padLeft(Long.toBinaryString(l), 64, '0');
String string = StringUtils.padLeft(Long.toBinaryString(l), 64, '0');
return toBinaryString("0b", string);
}

View File

@@ -2,7 +2,7 @@ package wxdgaming.boot.core.lang.keyword;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.BufferedReader;
import java.io.File;
@@ -231,10 +231,10 @@ public class KeyWord {
}
getKeyWords0(keyWordSet, txt, txt, matchType);
if (checkENCNCase) {
getKeyWords0(keyWordSet, txt, StringUtil.replaceFilter(txt, StringUtil.PATTERN_REPLACE_UUU), matchType);
getKeyWords0(keyWordSet, txt, StringUtil.replaceFilter(txt, StringUtil.PATTERN_REPLACE_UUU_1), matchType);
getKeyWords0(keyWordSet, txt, StringUtil.replaceFilter(txt, StringUtil.PATTERN_REPLACE_UUU_2), matchType);
getKeyWords0(keyWordSet, txt, StringUtil.replaceFilter(txt, StringUtil.PATTERN_REPLACE_UUU_3), matchType);
getKeyWords0(keyWordSet, txt, StringUtils.replaceFilter(txt, StringUtils.PATTERN_REPLACE_UUU), matchType);
getKeyWords0(keyWordSet, txt, StringUtils.replaceFilter(txt, StringUtils.PATTERN_REPLACE_UUU_1), matchType);
getKeyWords0(keyWordSet, txt, StringUtils.replaceFilter(txt, StringUtils.PATTERN_REPLACE_UUU_2), matchType);
getKeyWords0(keyWordSet, txt, StringUtils.replaceFilter(txt, StringUtils.PATTERN_REPLACE_UUU_3), matchType);
}
return keyWordSet;
}
@@ -321,10 +321,10 @@ public class KeyWord {
content = content.toLowerCase();
}
if (hasSensitiveWord0(content, matchType)/*整体过滤*/
|| hasSensitiveWord0(StringUtil.replaceFilter(content, StringUtil.PATTERN_REPLACE_UUU), matchType) /*过滤纯汉字的关键字*/
|| hasSensitiveWord0(StringUtil.replaceFilter(content, StringUtil.PATTERN_REPLACE_UUU_1), matchType) /*过滤纯英文的关键字*/
|| hasSensitiveWord0(StringUtil.replaceFilter(content, StringUtil.PATTERN_REPLACE_UUU_2), matchType) /*过滤纯数字的关键字*/
|| hasSensitiveWord0(StringUtil.replaceFilter(content, StringUtil.PATTERN_REPLACE_UUU_3), matchType)/*过滤掉汉字英文数字*/) {
|| hasSensitiveWord0(StringUtils.replaceFilter(content, StringUtils.PATTERN_REPLACE_UUU), matchType) /*过滤纯汉字的关键字*/
|| hasSensitiveWord0(StringUtils.replaceFilter(content, StringUtils.PATTERN_REPLACE_UUU_1), matchType) /*过滤纯英文的关键字*/
|| hasSensitiveWord0(StringUtils.replaceFilter(content, StringUtils.PATTERN_REPLACE_UUU_2), matchType) /*过滤纯数字的关键字*/
|| hasSensitiveWord0(StringUtils.replaceFilter(content, StringUtils.PATTERN_REPLACE_UUU_3), matchType)/*过滤掉汉字英文数字*/) {
return true;
}
}

View File

@@ -24,7 +24,7 @@ public interface StringHashCode {
* 计算字符串的hashcode值
*/
default int hashcode(String source) {
return StringUtil.hashcode(source);
return StringUtils.hashcode(source);
}
}

View File

@@ -23,7 +23,7 @@ import java.util.stream.Collectors;
* @author: wxd-gaming(無心道, 15388152619)
* @version: 2020-12-30 20:33
*/
public class StringUtil {
public class StringUtils {
public static final Charset GB2313 = Charset.forName("GB2312");
@@ -212,7 +212,7 @@ public class StringUtil {
/** uuid字符格式 8-4-4-4-12 */
public static String randomUuid16(String start, int len) {
StringBuilder stringBuilder = new StringBuilder(len);
if (notEmptyOrNull(start)) {
if (isNotBlank(start)) {
stringBuilder.append(start);
}
if (stringBuilder.length() < len) {
@@ -388,13 +388,13 @@ public class StringUtil {
}
/** 如果字符是null或者空白字符返回true */
public static boolean emptyOrNull(String str) {
return null == str || str.isEmpty() || str.isBlank();
public static boolean isBlank(String str) {
return null == str || str.isBlank();
}
/** 如果字符是null或者空白字符返回 false */
public static boolean notEmptyOrNull(String str) {
return !emptyOrNull(str);
public static boolean isNotBlank(String str) {
return !isBlank(str);
}
public static List<String> lines(String str) {

View File

@@ -9,7 +9,7 @@ import com.alibaba.fastjson.serializer.SerializeConfig;
import com.google.protobuf.Message;
import com.google.protobuf.MessageOrBuilder;
import wxdgaming.boot.agent.system.ReflectContext;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.IOException;
import java.lang.reflect.Type;
@@ -73,7 +73,7 @@ public class ProtobufMessageSerializerFastJson implements ObjectSerializer, Obje
@Override
public Object deserialze(DefaultJSONParser parser, Type type, Object fieldName) {
String fieldValue = (String) parser.parse(fieldName);
if (StringUtil.notEmptyOrNull(fieldValue)) {
if (StringUtils.isNotBlank(fieldValue)) {
Class ft = (Class) type;
if (Message.Builder.class.isAssignableFrom(ft)) {
return ProtobufSerializer.parseBuilder4Json(fieldValue, (Class) type);

View File

@@ -4,7 +4,7 @@ import com.google.protobuf.Message;
import com.google.protobuf.MessageOrBuilder;
import com.google.protobuf.util.JsonFormat;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
/**
* protobuf 消息协议序列化
@@ -20,7 +20,7 @@ public class ProtobufSerializer {
try {
stringBuilder.setLength(0);
JsonFormat.printer().sortingMapKeys().appendTo(object, stringBuilder);
return StringUtil.filterLine(stringBuilder.toString());
return StringUtils.filterLine(stringBuilder.toString());
} catch (Exception e) {
throw Throw.of(e);
}

View File

@@ -1,7 +1,7 @@
package wxdgaming.boot.core.system;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
@@ -160,7 +160,7 @@ public class JvmUtil {
* 采用 GMT时区设置
*/
public final static TimeZone setTimeZone(String zoneId) {
if (StringUtil.emptyOrNull(zoneId)) {
if (StringUtils.isBlank(zoneId)) {
throw new RuntimeException("zoneId = " + zoneId);
}
TimeZone timeZone = TimeZone.getTimeZone(zoneId);

View File

@@ -6,7 +6,7 @@ import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.GlobalUtil;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.assist.IAssistMonitor;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -100,7 +100,7 @@ public abstract class Event implements Runnable, IAssistMonitor, RunMonitor {
/** 提交待线程池执行 */
public final void submit() {
IExecutorServices executor;
if (StringUtil.notEmptyOrNull(getThreadName())) {
if (StringUtils.isNotBlank(getThreadName())) {
executor = Executors.All_THREAD_LOCAL.get(getThreadName());
} else if (isVt()) {
executor = Executors.getVTExecutor();

View File

@@ -2,7 +2,7 @@ package wxdgaming.boot.core.threading;
import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.GlobalUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -33,7 +33,7 @@ class ExecutorServiceJob implements Runnable, Job {
if (task instanceof Event event) {
this.runName = event.getTaskInfoString();
}
if (StringUtil.emptyOrNull(runName)) {
if (StringUtils.isBlank(runName)) {
StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[stackTrace + 1];
this.runName = stackTraceElement.getClassName()
+ "." + stackTraceElement.getMethodName()
@@ -117,7 +117,7 @@ class ExecutorServiceJob implements Runnable, Job {
if (v > logTime) {
String msg = "执行:" + runName + ", 耗时:" + v + " ms, 创建到执行完成:" + v2 + " ms, 主队列剩余:" + iExecutorServices.queueSize();
if (StringUtil.notEmptyOrNull(queueName)) {
if (StringUtils.isNotBlank(queueName)) {
msg = "子队列:" + queueName + ", 剩余" + iExecutorServices.getExecutorQueueMap().get(queueName).size() + "; " + msg;
}
@@ -143,7 +143,7 @@ class ExecutorServiceJob implements Runnable, Job {
}
@Override public boolean cancel() {
if (StringUtil.notEmptyOrNull(queueName)) {
if (StringUtils.isNotBlank(queueName)) {
return iExecutorServices.getExecutorQueueMap().computeIfAbsent(queueName, k -> new ExecutorQueue(iExecutorServices, k)).remove(this);
} else {
return iExecutorServices.threadPoolQueue().remove(this);

View File

@@ -3,7 +3,7 @@ package wxdgaming.boot.core.threading;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wxdgaming.boot.core.publisher.Mono;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.agent.GlobalUtil;
import java.util.List;
@@ -306,7 +306,7 @@ public interface IExecutorServices extends Executor {
/**定时器任务,需要重置一次*/
job.initTaskTime = System.nanoTime();
job.append.set(true);
if (StringUtil.notEmptyOrNull(queueName)) {
if (StringUtils.isNotBlank(queueName)) {
ExecutorQueue executorQueue = getExecutorQueueMap().computeIfAbsent(queueName, k -> new ExecutorQueue(this, k));
executorQueue.add(job);
} else {

View File

@@ -1,7 +1,7 @@
package wxdgaming.boot.core.threading;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.lang.reflect.Method;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -22,10 +22,10 @@ public class ThreadInfoImpl {
ThreadInfo ann = AnnUtil.ann(method, ThreadInfo.class);
if (ann != null) {
vt.set(ann.vt());
if (StringUtil.notEmptyOrNull(ann.threadName())) {
if (StringUtils.isNotBlank(ann.threadName())) {
threadName.set(ann.threadName());
}
if (StringUtil.notEmptyOrNull(ann.queueName())) {
if (StringUtils.isNotBlank(ann.queueName())) {
queueName.set(ann.queueName());
}
}

View File

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.annotation.JSONField;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.core.lang.ObjectBase;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.util.Arrays;
import java.util.TreeSet;
@@ -75,10 +75,10 @@ public class CronExpress extends ObjectBase {
String[] values = new String[7];
Arrays.fill(values, "*");
if (StringUtil.notEmptyOrNull(cron)) {
if (StringUtils.isNotBlank(cron)) {
String[] split = cron.split(" ");
for (int i = 0; i < split.length; i++) {
if (StringUtil.emptyOrNull(split[i])) {
if (StringUtils.isBlank(split[i])) {
throw new RuntimeException("cron 表达式异常 [" + cron + "] 第 " + (i + 1) + " 个参数 空 不合法");
}
values[i] = split[i];

View File

@@ -8,7 +8,7 @@ import wxdgaming.boot.agent.GlobalUtil;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.assist.JavaAssistBox;
import wxdgaming.boot.core.ann.Sort;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.threading.Event;
import wxdgaming.boot.core.threading.ThreadInfo;
import wxdgaming.boot.core.timer.ann.Scheduled;
@@ -74,7 +74,7 @@ public class ScheduledInfo extends Event implements Comparable<ScheduledInfo> {
javaAssist.getCtClass().defrost();
javaAssist.getCtClass().detach();
if (StringUtil.notEmptyOrNull(scheduled.name())) {
if (StringUtils.isNotBlank(scheduled.name())) {
this.name = "[scheduled-job]" + scheduled.name();
} else {
this.name = "[scheduled-job]" + instance.getClass().getName() + "." + method.getName();

View File

@@ -6,7 +6,7 @@ import org.apache.http.NameValuePair;
import org.apache.http.client.methods.CloseableHttpResponse;
import wxdgaming.boot.agent.zip.GzipUtil;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.net.http.HttpHeadNameType;
import java.nio.charset.Charset;
@@ -68,7 +68,7 @@ public final class Response<H extends HttpBase> {
}
public String bodyUnicodeDecodeString() {
return StringUtil.unicodeDecode(bodyString());
return StringUtils.unicodeDecode(bodyString());
}
public Response<H> logDebug() {

View File

@@ -11,7 +11,7 @@ import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.GlobalUtil;
import wxdgaming.boot.core.collection.concurrent.ConcurrentHashSet;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.system.BytesUnit;
import wxdgaming.boot.core.system.JvmUtil;
import wxdgaming.boot.net.http.ssl.SslProtocolType;
@@ -197,7 +197,7 @@ public abstract class NioServer<S extends Session> extends NioBase implements Ru
public boolean checkIPFilter(String ip) {
try {
if (StringUtil.emptyOrNull(ip)) {
if (StringUtils.isBlank(ip)) {
log.warn("ip地址欺诈" + ip);
return false;
}

View File

@@ -6,7 +6,7 @@ import lombok.Setter;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.core.lang.LockBase;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.timer.MyClock;
import java.io.Serializable;
@@ -143,19 +143,19 @@ public abstract class Session extends LockBase implements Serializable {
}
public String getIp() {
if (StringUtil.emptyOrNull(this.ip))
if (StringUtils.isBlank(this.ip))
this.ip = NioFactory.getIP(this.channelContext);
return ip;
}
public String getLocalAddress() {
if (StringUtil.emptyOrNull(this.localAddress))
if (StringUtils.isBlank(this.localAddress))
this.localAddress = NioFactory.getLocalAddress(channelContext);
return localAddress;
}
public String getRemoteAddress() {
if (StringUtil.emptyOrNull(this.remoteAddress))
if (StringUtils.isBlank(this.remoteAddress))
this.remoteAddress = NioFactory.getRemoteAddress(channelContext);
return remoteAddress;
}

View File

@@ -4,7 +4,7 @@ import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.agent.system.MethodUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.net.NioBase;
import wxdgaming.boot.net.SocketSession;
import wxdgaming.boot.net.controller.ann.ProtoController;
@@ -66,7 +66,7 @@ public class MappingProtoAction {
int messageId = MessagePackage.getMessageId(messageClass);
String remarks = protoMapping.remarks();
if (StringUtil.emptyOrNull(remarks)) {
if (StringUtils.isBlank(remarks)) {
remarks = instance.getClass().getName() + "." + method.getName();
}
MappingFactory.putProto(

View File

@@ -2,7 +2,7 @@ package wxdgaming.boot.net.controller;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.agent.system.MethodUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.net.NioBase;
import wxdgaming.boot.net.controller.ann.TextController;
import wxdgaming.boot.net.controller.ann.TextMapping;
@@ -42,7 +42,7 @@ public class MappingTextAction {
*/
public static void bindCmd(Class<? extends NioBase> service, String parentUrl, Object instance, Collection<Method> methodList) {
String url = parentUrl;
if (StringUtil.emptyOrNull(url)) {
if (StringUtils.isBlank(url)) {
url = instance.getClass().getSimpleName().toLowerCase();
if (url.endsWith("controller")) {
url = url.replace("controller", "");
@@ -70,7 +70,7 @@ public class MappingTextAction {
TextMapping mapping = AnnUtil.ann(method, TextMapping.class);
if (mapping != null) {
String cmdUrl = url;
if (StringUtil.notEmptyOrNull(mapping.basePath())) {
if (StringUtils.isNotBlank(mapping.basePath())) {
cmdUrl = mapping.basePath();
}
@@ -84,7 +84,7 @@ public class MappingTextAction {
String mappingName = mapping.path();
if (StringUtil.emptyOrNull(mappingName)) {
if (StringUtils.isBlank(mappingName)) {
cmdUrl += method.getName().toLowerCase().trim();
} else {
cmdUrl += mappingName.toLowerCase().trim();
@@ -92,7 +92,7 @@ public class MappingTextAction {
cmdUrl = "/" + cmdUrl;
String remarks = mapping.remarks();
if (StringUtil.emptyOrNull(remarks)) {
if (StringUtils.isBlank(remarks)) {
remarks = cmdUrl;
}

View File

@@ -10,7 +10,7 @@ import wxdgaming.boot.agent.io.FileReadUtil;
import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.core.append.StreamWriter;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.TemplatePack;
import wxdgaming.boot.core.timer.MyClock;
import wxdgaming.boot.net.SocketSession;
@@ -109,8 +109,8 @@ public class ProtoBufCreateController {
boolean matches = messageName.matches(_startsWithRegex);
if (matches) {
int indexOf = messageName.lastIndexOf('{');
messageName = StringUtil.filterLine(messageName.substring(0, indexOf));
int msgId = StringUtil.hashcode(messageName);
messageName = StringUtils.filterLine(messageName.substring(0, indexOf));
int msgId = StringUtils.hashcode(messageName);
String key = messagePackage.get() + "." + messageName;
if (msgIdMap.containsKey(key) || msgIdMap.containsValue(msgId)) {
throw new RuntimeException("存在相同的消息名称:" + key + ", id=" + msgId);
@@ -157,7 +157,7 @@ public class ProtoBufCreateController {
boolean matches = message.matches(_startsWithRegex);
if (matches) {
int indexOf = message.lastIndexOf('{');
message = StringUtil.filterLine(message.substring(0, indexOf));
message = StringUtils.filterLine(message.substring(0, indexOf));
String savePack = messagePackage.get().replace(".message", ".controller");
String saveClassName = message + "Controller";
@@ -192,7 +192,7 @@ public class ProtoBufCreateController {
objMap.put("savePack", savePack);
objMap.put("saveClassName", saveClassName);
if (StringUtil.emptyOrNull(serviceClass)) {
if (StringUtils.isBlank(serviceClass)) {
objMap.put("serviceClass", "");
} else {
objMap.put("serviceClass", "service = \"" + serviceClass + "\"");
@@ -213,7 +213,7 @@ public class ProtoBufCreateController {
out.writeLn("==============================================================================================================");
out.writeLn("消息文件:" + protoFile.getName());
out.writeLn("消息名称:" + messagePackage.get() + "." + message);
out.writeLn("消息ID" + StringUtil.hashcode(objMap.getString("messageName")));
out.writeLn("消息ID" + StringUtils.hashcode(objMap.getString("messageName")));
out.writeLn("文件包名:" + objMap.getString("savePack"));
out.writeLn("处理文件:" + objMap.getString("saveClassName") + ".java");
out.writeLn("==============================================================================================================");

View File

@@ -5,7 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.zip.GzipUtil;
import wxdgaming.boot.core.append.StreamWriter;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.system.MarkTimer;
import wxdgaming.boot.net.SocketSession;
@@ -62,7 +62,7 @@ public class ReqRemoteHandler {
session.rpcResponse(rpcId, "OK!");
}
default -> {
if (StringUtil.emptyOrNull(cmd)) {
if (StringUtils.isBlank(cmd)) {
log.info("{} 命令参数 cmd , 未找到", session.toString());
if (rpcId > 0) {
session.rpcResponse(rpcId, RunResult.error("命令参数 cmd , 未找到").toJSONString());

View File

@@ -5,7 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.GlobalUtil;
import wxdgaming.boot.core.append.StreamWriter;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.threading.Event;
import wxdgaming.boot.net.Session;
@@ -79,7 +79,7 @@ public final class RpcListenerAction extends Event {
/*实现注入*/
Param annotation = parameter.getAnnotation(Param.class);
if (annotation.required() && !putData.containsKey(annotation.value())) {
if (StringUtil.notEmptyOrNull(annotation.defaultValue())) {
if (StringUtils.isNotBlank(annotation.defaultValue())) {
putData.put(annotation.value(), annotation.defaultValue());
} else {
throw new RuntimeException("listener " + listener + ", 接口 " + mappingRecord.method() + ", 参数 " + annotation.value() + " 为必传参数,但未传");

View File

@@ -3,7 +3,7 @@ package wxdgaming.boot.net.message;
import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.agent.system.ReflectContext;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.net.pojo.PojoBase;
import java.util.Map;
@@ -34,10 +34,10 @@ public class MessagePackage {
}
public static void main(String[] args) {
System.out.println(StringUtil.hashcode(new String(new char[]{2, 1})));
System.out.println(StringUtil.hashcode(new String(new char[]{1, 2})));
System.out.println(StringUtil.hashcode("re"));
System.out.println(StringUtil.hashcode("er"));
System.out.println(StringUtils.hashcode(new String(new char[]{2, 1})));
System.out.println(StringUtils.hashcode(new String(new char[]{1, 2})));
System.out.println(StringUtils.hashcode("re"));
System.out.println(StringUtils.hashcode("er"));
}
/** 获取 获取消息信息 messageName = msgid */
@@ -121,7 +121,7 @@ public class MessagePackage {
return;
}
}
int number = StringUtil.hashcode(declaredClass.getSimpleName());
int number = StringUtils.hashcode(declaredClass.getSimpleName());
final Integer nameNumber = MsgName2IdMap.get(messageName);
if (nameNumber != null && number != nameNumber) {
throw new RuntimeException("存在相同的消息名称:" + messageName + "=" + nameNumber);

View File

@@ -9,7 +9,7 @@ import wxdgaming.boot.core.format.UniqueID;
import wxdgaming.boot.core.lang.Cache;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.publisher.Mono;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.system.MarkTimer;
import wxdgaming.boot.core.threading.Event;
import wxdgaming.boot.core.threading.Executors;
@@ -154,7 +154,7 @@ public class RpcEvent {
} catch (InterruptedException e) {
throw Throw.of(e);
}
if (StringUtil.emptyOrNull(this.resJson)) {
if (StringUtils.isBlank(this.resJson)) {
throw new RuntimeException("get time out");
}
}

View File

@@ -9,7 +9,7 @@ import wxdgaming.boot.agent.io.FileReadUtil;
import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.agent.io.FileWriteUtil;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.system.MarkTimer;
import wxdgaming.boot.core.timer.MyClock;
@@ -58,7 +58,7 @@ public class UpFileAccess implements Serializable {
}
UpFileAccess upFileAccess = new UpFileAccess();
upFileAccess.fileId = StringUtil.hashcode(file.getPath());
upFileAccess.fileId = StringUtils.hashcode(file.getPath());
upFileAccess.filePath = file.getPath();
upFileAccess.jsonObject = MapOf.newJSONObject();
upFileAccess.jsonObject.put(FileDir, upFileDir);
@@ -79,7 +79,7 @@ public class UpFileAccess implements Serializable {
String fileDir = fileAccess.jsonObject.getString(FileDir);
String upLoadPath;
if (StringUtil.emptyOrNull(fileDir)) {
if (StringUtils.isBlank(fileDir)) {
upLoadPath = FileUtil.getCanonicalPath(new File("upload"));
} else {
upLoadPath = FileUtil.getCanonicalPath(new File(fileDir));

View File

@@ -11,7 +11,7 @@ import wxdgaming.boot.agent.io.FileWriteUtil;
import wxdgaming.boot.agent.system.ReflectContext;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.lang.ObjectBase;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.net.SocketSession;
import wxdgaming.boot.net.controller.ann.ProtoMapping;
@@ -62,7 +62,7 @@ public class ProtoBuf2Pojo {
FileReadUtil.readLine(filePath, StandardCharsets.UTF_8, line -> {
line = line.trim();
if (StringUtil.emptyOrNull(line)) return;
if (StringUtils.isBlank(line)) return;
if (line.contains("java_multiple_files")) {
// if (line.contains("true")) {
// multiple_files.set(true);
@@ -87,7 +87,7 @@ public class ProtoBuf2Pojo {
String string = comment.get().string();
if (multiple_files.get()) {
String p1 = filePath.getName().replace(".proto", "").replace("Message", "");
p1 = StringUtil.lowerFirst(p1);
p1 = StringUtils.lowerFirst(p1);
String to = "package " + packageName + "." + p1 + ";";
to += "\n";
for (String anImport : imports) {
@@ -157,7 +157,7 @@ public class ProtoBuf2Pojo {
}
public void addField(FiledInfo filedInfo) {
if (StringUtil.notEmptyOrNull(filedInfo.getField())) {
if (StringUtils.isNotBlank(filedInfo.getField())) {
if (filedInfos.stream().anyMatch(v -> v.getTag() == filedInfo.getTag())) {
// tag重复
throw new RuntimeException(className + " - tag " + filedInfo.getTag() + " 重复");
@@ -315,7 +315,7 @@ public class ProtoBuf2Pojo {
private String comment = "";
public FiledInfo(String classType, String line) {
if (StringUtil.emptyOrNull(line)) {
if (StringUtils.isBlank(line)) {
return;
}
line = line.trim();
@@ -329,7 +329,7 @@ public class ProtoBuf2Pojo {
tmp.add("enum");
}
for (String string : split1) {
if (StringUtil.emptyOrNull(string)) continue;
if (StringUtils.isBlank(string)) continue;
tmp.add(string.trim());
}
@@ -380,7 +380,7 @@ public class ProtoBuf2Pojo {
default: {
if (string.startsWith("map<") && string.endsWith(">")) {
field = String.class.getSimpleName();
field = StringUtil.upperFirst(field);
field = StringUtils.upperFirst(field);
field = field
.replace("bool", Boolean.class.getSimpleName())
.replace("int32", Integer.class.getSimpleName())

View File

@@ -5,7 +5,7 @@ import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.cookie.*;
import io.netty.util.AsciiString;
import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import java.io.Serializable;
import java.util.LinkedHashSet;
@@ -63,8 +63,8 @@ public class CookiePack implements Serializable {
return cookies.stream()
.filter(v -> Objects.equals(v.name(), cookieKey))
.filter(v -> {
if (StringUtil.emptyOrNull(v.path())) return true;
if (StringUtil.emptyOrNull(cookiePath)) return true;
if (StringUtils.isBlank(v.path())) return true;
if (StringUtils.isBlank(cookiePath)) return true;
return Objects.equals(v.path(), cookiePath);
})
.findFirst()
@@ -178,7 +178,7 @@ public class CookiePack implements Serializable {
*/
public CookiePack clientCookie(HttpHeaders httpHeaders) {
final String clientCookieString = clientCookieString();
if (StringUtil.notEmptyOrNull(clientCookieString)) {
if (StringUtils.isNotBlank(clientCookieString)) {
httpHeaders.set(HttpHeaderNames.COOKIE, clientCookieString);
}
return this;

View File

@@ -15,7 +15,7 @@ import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.agent.lang.Record2;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.threading.Event;
import wxdgaming.boot.core.timer.MyClock;
@@ -163,7 +163,7 @@ public final class HttpListenerAction extends Event {
/*实现注入*/
Param annotation = parameter.getAnnotation(Param.class);
if (annotation.required() && !putData.containsKey(annotation.value())) {
if (StringUtil.notEmptyOrNull(annotation.defaultValue())) {
if (StringUtils.isNotBlank(annotation.defaultValue())) {
putData.put(annotation.value(), annotation.defaultValue());
} else {
throw new RuntimeException("listener " + urlPath + ", 接口 " + mappingRecord.method() + ", 参数 " + annotation.value() + " 为必传参数,但未传");

View File

@@ -17,7 +17,7 @@ import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.agent.zip.GzipUtil;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.system.JvmUtil;
import wxdgaming.boot.core.timer.MyClock;
import wxdgaming.boot.net.NioFactory;
@@ -241,7 +241,7 @@ public class HttpServer extends NioServer<HttpSession> {
}
public String resourcesPath() throws IOException {
if (StringUtil.emptyOrNull(resourcesPath)) {
if (StringUtils.isBlank(resourcesPath)) {
resourcesPath = FileUtil.getCanonicalPath(new File("html"));
}
return resourcesPath;
@@ -462,7 +462,7 @@ public class HttpServer extends NioServer<HttpSession> {
* {@code key=value&key=value&key=value&key=value&key=value}
*/
public static void queryStringMap(Map paramsMap, String queryString) {
if (StringUtil.emptyOrNull(queryString)) {
if (StringUtils.isBlank(queryString)) {
return;
}
QueryStringDecoder queryDecoder = new QueryStringDecoder(queryString, false);

View File

@@ -10,7 +10,7 @@ import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.system.BytesUnit;
import wxdgaming.boot.core.timer.MyClock;
@@ -277,7 +277,7 @@ public class HttpSession extends Session implements Serializable {
}
}
if (StringUtil.emptyOrNull(uriPathString) || "/".equalsIgnoreCase(uriPathString)) {
if (StringUtils.isBlank(uriPathString) || "/".equalsIgnoreCase(uriPathString)) {
uriPathString = "/index.html";
}
@@ -363,7 +363,7 @@ public class HttpSession extends Session implements Serializable {
if (data.getHttpDataType() == InterfaceHttpData.HttpDataType.Attribute) {
Attribute attribute = (Attribute) data;
String get = this.getReqParams().getString(data.getName());
if (StringUtil.notEmptyOrNull(get)) {
if (StringUtils.isNotBlank(get)) {
get = get + "," + attribute.getValue();
} else {
get = attribute.getValue();
@@ -390,7 +390,7 @@ public class HttpSession extends Session implements Serializable {
this.reqContent = new String(this.reqContentByteBuf, StandardCharsets.UTF_8);
this.reqContent = URLDecoder.decode(this.reqContent, StandardCharsets.UTF_8);
if (this.reqContentType.contains("json")) {
if (StringUtil.notEmptyOrNull(this.reqContent)) {
if (StringUtils.isNotBlank(this.reqContent)) {
final JSONObject jsonObject = FastJsonUtil.parse(this.reqContent);
if (jsonObject != null && !jsonObject.isEmpty()) {
this.getReqParams().putAll(jsonObject);

View File

@@ -5,7 +5,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import wxdgaming.boot.agent.io.FileReadUtil;
import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.system.JvmUtil;
import wxdgaming.boot.net.controller.ann.TextMapping;
import wxdgaming.boot.net.http.HttpDataAction;
@@ -36,7 +36,7 @@ public interface HttpFtp {
String search = putData.getString("search");
String path = putData.getString("path");
if (StringUtil.emptyOrNull(path)) {
if (StringUtils.isBlank(path)) {
path = userHome;
}

View File

@@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory;
import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.system.JvmUtil;
import wxdgaming.boot.net.controller.ann.TextMapping;
import wxdgaming.boot.net.web.hs.HttpSession;
@@ -33,7 +33,7 @@ public interface HttpUpload {
String fileDir = httpSession.reqParam("filedir");
String dirPath = null;
if (StringUtil.emptyOrNull(fileDir)) {
if (StringUtils.isBlank(fileDir)) {
dirPath = FileUtil.getCanonicalPath(new File("upload"));
} else {
dirPath = FileUtil.getCanonicalPath(new File(fileDir));

View File

@@ -7,7 +7,7 @@ import io.netty.handler.codec.http.HttpVersion;
import wxdgaming.boot.core.collection.ListOf;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.format.ByteFormat;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.TemplatePack;
import wxdgaming.boot.core.system.JvmUtil;
import wxdgaming.boot.core.timer.MyClock;
@@ -41,8 +41,8 @@ public class FtpFileUtil implements Serializable {
if (pageSize <= 0) pageSize = 50;
if (pageNumber < 1) pageNumber = 1;
if (StringUtil.emptyOrNull(search)) search = "";
if (StringUtil.emptyOrNull(ftpPath) || !ftpPath.startsWith(userHome)) {
if (StringUtils.isBlank(search)) search = "";
if (StringUtils.isBlank(ftpPath) || !ftpPath.startsWith(userHome)) {
ftpPath = userHome;
}
@@ -94,7 +94,7 @@ public class FtpFileUtil implements Serializable {
final String searchFile = search.toLowerCase();
List<File> collect = Arrays.stream(files)
.filter(file1 -> {
if (StringUtil.notEmptyOrNull(searchFile)) {
if (StringUtils.isNotBlank(searchFile)) {
if (!file1.getName().toLowerCase().contains(searchFile)) {
/*如果有搜索,不匹配不要*/
return false;

View File

@@ -15,7 +15,7 @@ import wxdgaming.boot.agent.io.FileUtil;
import wxdgaming.boot.agent.lang.Record2;
import wxdgaming.boot.agent.system.ReflectContext;
import wxdgaming.boot.core.collection.SetOf;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.ProtobufMessageSerializerFastJson;
import wxdgaming.boot.core.str.xml.XmlUtil;
import wxdgaming.boot.core.system.BytesUnit;
@@ -97,7 +97,7 @@ public class AppContext {
});
GlobalUtil.exceptionCall = (o, throwable) -> {
if (StringUtil.notEmptyOrNull(FeishuPack.Default.DefaultFeishuUrl))
if (StringUtils.isNotBlank(FeishuPack.Default.DefaultFeishuUrl))
FeishuPack.Default.asyncFeiShuNotice("异常", String.valueOf(o), throwable);
};
@@ -268,11 +268,11 @@ public class AppContext {
stringAppend.append("\n\n")
.append(printString)
.append("\n")
.append(" -[ " + StringUtil.padRight("debug = " + debug + " | " + JvmUtil.processIDString(), len, ' ') + " ]-\n")
.append(" -[ " + StringUtil.padRight(serverId + " | " + serverName, len, ' ') + " ]-\n")
.append(" -[ " + StringUtil.padRight(JvmUtil.timeZone(), len, ' ') + " ]-\n");
.append(" -[ " + StringUtils.padRight("debug = " + debug + " | " + JvmUtil.processIDString(), len, ' ') + " ]-\n")
.append(" -[ " + StringUtils.padRight(serverId + " | " + serverName, len, ' ') + " ]-\n")
.append(" -[ " + StringUtils.padRight(JvmUtil.timeZone(), len, ' ') + " ]-\n");
for (String extInfo : extInfos) {
stringAppend.append(" -[ " + StringUtil.padRight(extInfo, len, ' ') + " ]-\n");
stringAppend.append(" -[ " + StringUtils.padRight(extInfo, len, ' ') + " ]-\n");
}
stringAppend.append("\n");
logger().warn(stringAppend.toString());

View File

@@ -1,7 +1,6 @@
package wxdgaming.boot.starter;
import com.google.inject.AbstractModule;
import com.google.inject.Injector;
import com.google.inject.Singleton;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
@@ -9,7 +8,7 @@ import wxdgaming.boot.agent.function.ConsumerE2;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.agent.system.ReflectContext;
import wxdgaming.boot.batis.DbConfig;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.net.controller.ann.ProtoController;
import wxdgaming.boot.net.controller.ann.TextController;
@@ -77,12 +76,12 @@ abstract class BaseModule<T extends BaseModule> extends AbstractModule {
protected final ConsumerE2<Class, TcpConfig> socketAction = (aClass, config) -> {
if (config.getPort() > 0) {
if (StringUtil.notEmptyOrNull(config.getServiceClassName())) {
if (StringUtils.isNotBlank(config.getServiceClassName())) {
/*通过指定的类进行加载*/
aClass = BootStarterModule.class.getClassLoader().loadClass(config.getServiceClassName());
}
Object newInstance = aClass.getDeclaredConstructor(config.getClass()).newInstance(config);
if (StringUtil.emptyOrNull(config.getName())) {
if (StringUtils.isBlank(config.getName())) {
config.setName(newInstance.getClass().getSimpleName());
}
bindSingleton(aClass, newInstance);
@@ -92,7 +91,7 @@ abstract class BaseModule<T extends BaseModule> extends AbstractModule {
protected final ConsumerE2<Class, DbConfig> dbAction = (aClass, config) -> {
if (config.getDbPort() > 0) {
Object newInstance = aClass.getDeclaredConstructor(config.getClass()).newInstance(config);
if (StringUtil.emptyOrNull(config.getName())) {
if (StringUtils.isBlank(config.getName())) {
config.setName(newInstance.getClass().getSimpleName());
}
bindSingleton(aClass, newInstance);

View File

@@ -10,7 +10,7 @@ import wxdgaming.boot.agent.function.*;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.agent.system.MethodUtil;
import wxdgaming.boot.core.ann.Sort;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.starter.config.Config;
import java.lang.reflect.Method;
@@ -198,7 +198,7 @@ public interface ContextAction {
}
Method method1 = null;
Method method2 = null;
if (StringUtil.notEmptyOrNull(methodName)) {
if (StringUtils.isNotBlank(methodName)) {
method1 = MethodUtil.findMethod(o1.getClass(), methodName);
method2 = MethodUtil.findMethod(o2.getClass(), methodName);
}

View File

@@ -5,7 +5,7 @@ import wxdgaming.boot.agent.exception.Throw;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.collection.SplitCollection;
import wxdgaming.boot.core.lang.LockBase;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.system.JvmUtil;
import wxdgaming.boot.core.system.LocalHostUtil;
@@ -67,7 +67,7 @@ public class FeishuPack extends Event {
/** feiShuN通知 "<at user_id=\"xxx\">xx</at>" */
public void asyncFeiShuNotice(String url, String title, String content) {
if (StringUtil.emptyOrNull(url) || StringUtil.emptyOrNull(title) || StringUtil.emptyOrNull(content)) return;
if (StringUtils.isBlank(url) || StringUtils.isBlank(title) || StringUtils.isBlank(content)) return;
lockBase.lock();
try {
TreeMap<String, SplitCollection<String>> map = cache.computeIfAbsent(url, l -> new TreeMap<>());

View File

@@ -6,7 +6,7 @@ import lombok.Setter;
import lombok.experimental.Accessors;
import org.simpleframework.xml.Element;
import wxdgaming.boot.core.lang.ObjectBase;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.net.http.ssl.SslContextServer;
import wxdgaming.boot.net.http.ssl.SslProtocolType;
@@ -51,7 +51,7 @@ public class TcpConfig extends ObjectBase implements Serializable {
private String serviceClassName = null;
public SslProtocolType sslProtocolType() throws Exception {
if (StringUtil.notEmptyOrNull(sslProtocolType)) {
if (StringUtils.isNotBlank(sslProtocolType)) {
return SslProtocolType.of(sslProtocolType);
}
return SslProtocolType.TLSV12;

View File

@@ -8,7 +8,7 @@ import wxdgaming.boot.agent.io.FileWriteUtil;
import wxdgaming.boot.agent.lang.Record2;
import wxdgaming.boot.agent.system.AnnUtil;
import wxdgaming.boot.agent.zip.GzipUtil;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.str.xml.XmlUtil;
import wxdgaming.boot.starter.config.Config;
@@ -36,7 +36,7 @@ public class ActionConfig {
if (config != null) {
/*配置文件路径*/
String configPath = config.value();
if (StringUtil.emptyOrNull(configPath)) {
if (StringUtils.isBlank(configPath)) {
configPath = aClass.getSimpleName().toLowerCase() + "." + config.configType().name().toLowerCase();
}
@@ -91,7 +91,7 @@ public class ActionConfig {
Config config = AnnUtil.ann(object.getClass(), Config.class);
/*配置文件路径*/
String configPath = config.value();
if (StringUtil.emptyOrNull(configPath)) {
if (StringUtils.isBlank(configPath)) {
configPath = "config/" + object.getClass().getSimpleName().toLowerCase() + "." + config.configType().name().toLowerCase();
}
switch (config.configType()) {

View File

@@ -9,7 +9,7 @@ import wxdgaming.boot.agent.system.Base64Util;
import wxdgaming.boot.agent.zip.ZipUtil;
import wxdgaming.boot.core.collection.MapOf;
import wxdgaming.boot.core.lang.RunResult;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.core.system.PrintConsole;
import wxdgaming.boot.httpclient.apache.HttpBuilder;
@@ -42,7 +42,7 @@ public class PostCode implements PrintConsole {
for (Post_Run_Config.Urls urls : post_run_config.getUrlList()) {
i++;
System.out.print(StringUtil.padRight(urls.getServerId() + " - " + urls.getName(), maxLen, ' ') + "\t");
System.out.print(StringUtils.padRight(urls.getServerId() + " - " + urls.getName(), maxLen, ' ') + "\t");
if (i % 8 == 0) {
System.out.println();
}
@@ -55,7 +55,7 @@ public class PostCode implements PrintConsole {
System.out.println();
int sid = Integer.parseInt(readLine);
Post_Run_Config.Urls urls = post_run_config.findBySid(sid);
if (StringUtil.notEmptyOrNull(urls.getPwd())) {
if (StringUtils.isNotBlank(urls.getPwd())) {
System.out.println("!!!!!!谨慎操作远程服务器请!!!!!");
System.out.print("输入密码:");
String pwd = bufferedReader.readLine();
@@ -68,7 +68,7 @@ public class PostCode implements PrintConsole {
}
String selectIp = urls.getUrl();
System.out.println("选择服务器:" + urls.getName() + ", " + urls.getUrl());
if (StringUtil.notEmptyOrNull(urls.getPwd())) {
if (StringUtils.isNotBlank(urls.getPwd())) {
System.out.println("!!!!!!再次确认选择的服务器是否正确!!!!!");
bufferedReader.readLine();
}

View File

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.TypeReference;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import wxdgaming.boot.core.str.Md5Util;
import wxdgaming.boot.core.str.StringUtil;
import wxdgaming.boot.core.str.StringUtils;
import wxdgaming.boot.core.str.json.FastJsonUtil;
import wxdgaming.boot.httpclient.apache.HttpBuilder;
@@ -44,7 +44,7 @@ public class IBackendApiImplTest {
.bodyUnicodeDecodeString();
log.info("{} {}{}", "dd", "接口测试", FastJsonUtil.toJson(result));
if (StringUtil.notEmptyOrNull(result)) {
if (StringUtils.isNotBlank(result)) {
HashMap<String, String> resMap = FastJsonUtil.parse(result, new TypeReference<HashMap<String, String>>() {});
}
}