diff --git a/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonAutoConfiguration.java b/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonAutoConfiguration.java index 99a58a92..cf5867cc 100644 --- a/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonAutoConfiguration.java +++ b/continew-starter-cache/continew-starter-cache-redisson/src/main/java/top/charles7c/continew/starter/cache/redisson/autoconfigure/RedissonAutoConfiguration.java @@ -18,7 +18,7 @@ package top.charles7c.continew.starter.cache.redisson.autoconfigure; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import com.fasterxml.jackson.databind.ObjectMapper; import org.redisson.codec.JsonJacksonCodec; import org.redisson.config.ClusterServersConfig; @@ -101,7 +101,7 @@ public class RedissonAutoConfiguration { List nodeList = redisProperties.getCluster().getNodes(); nodeList.stream().map(node -> protocolPrefix + node).forEach(clusterServersConfig::addNodeAddress); } - if (StrUtil.isBlank(clusterServersConfig.getPassword())) { + if (CharSequenceUtil.isBlank(clusterServersConfig.getPassword())) { clusterServersConfig.setPassword(redisProperties.getPassword()); } } @@ -124,10 +124,10 @@ public class RedissonAutoConfiguration { List nodeList = redisProperties.getSentinel().getNodes(); nodeList.stream().map(node -> protocolPrefix + node).forEach(sentinelServersConfig::addSentinelAddress); } - if (StrUtil.isBlank(sentinelServersConfig.getPassword())) { + if (CharSequenceUtil.isBlank(sentinelServersConfig.getPassword())) { sentinelServersConfig.setPassword(redisProperties.getPassword()); } - if (StrUtil.isBlank(sentinelServersConfig.getMasterName())) { + if (CharSequenceUtil.isBlank(sentinelServersConfig.getMasterName())) { sentinelServersConfig.setMasterName(redisProperties.getSentinel().getMaster()); } } @@ -146,10 +146,10 @@ public class RedissonAutoConfiguration { } // 下方配置如果为空,则使用 Redis 的配置 singleServerConfig.setDatabase(redisProperties.getDatabase()); - if (StrUtil.isBlank(singleServerConfig.getPassword())) { + if (CharSequenceUtil.isBlank(singleServerConfig.getPassword())) { singleServerConfig.setPassword(redisProperties.getPassword()); } - if (StrUtil.isBlank(singleServerConfig.getAddress())) { + if (CharSequenceUtil.isBlank(singleServerConfig.getAddress())) { singleServerConfig.setAddress(protocolPrefix + redisProperties .getHost() + StringConstants.COLON + redisProperties.getPort()); } diff --git a/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java b/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java index 344c6db8..919435c2 100644 --- a/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java +++ b/continew-starter-cache/continew-starter-cache-springcache/src/main/java/top/charles7c/continew/starter/cache/springcache/autoconfigure/SpringCacheAutoConfiguration.java @@ -17,7 +17,7 @@ package top.charles7c.continew.starter.cache.springcache.autoconfigure; import cn.hutool.core.map.MapUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.crypto.digest.DigestUtil; import cn.hutool.json.JSONUtil; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -92,7 +92,7 @@ public class SpringCacheAutoConfiguration implements CachingConfigurer { @Override public KeyGenerator keyGenerator() { return (target, method, params) -> { - String key = StrUtil.toUnderlineCase(method.getName()).toUpperCase(); + String key = CharSequenceUtil.toUnderlineCase(method.getName()).toUpperCase(); Map paramMap = MapUtil.newHashMap(params.length); for (int i = 0; i < params.length; i++) { paramMap.put(String.valueOf(i), params[i]); diff --git a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java index db36f074..ef7201f6 100644 --- a/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java +++ b/continew-starter-captcha/continew-starter-captcha-behavior/src/main/java/top/charles7c/continew/starter/captcha/behavior/autoconfigure/BehaviorCaptchaAutoConfiguration.java @@ -18,7 +18,7 @@ package top.charles7c.continew.starter.captcha.behavior.autoconfigure; import cn.hutool.core.codec.Base64; import cn.hutool.core.io.FileUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import com.anji.captcha.model.common.Const; import com.anji.captcha.service.CaptchaService; import com.anji.captcha.service.impl.CaptchaServiceFactory; @@ -81,8 +81,8 @@ public class BehaviorCaptchaAutoConfiguration { config.put(Const.CAPTCHA_FONT_TYPE, properties.getFontType()); config.put(Const.CAPTCHA_TYPE, properties.getType().getCodeValue()); config.put(Const.CAPTCHA_INTERFERENCE_OPTIONS, properties.getInterferenceOptions()); - config.put(Const.ORIGINAL_PATH_JIGSAW, StrUtil.emptyIfNull(properties.getJigsawBaseMapPath())); - config.put(Const.ORIGINAL_PATH_PIC_CLICK, StrUtil.emptyIfNull(properties.getPicClickBaseMapPath())); + config.put(Const.ORIGINAL_PATH_JIGSAW, CharSequenceUtil.emptyIfNull(properties.getJigsawBaseMapPath())); + config.put(Const.ORIGINAL_PATH_PIC_CLICK, CharSequenceUtil.emptyIfNull(properties.getPicClickBaseMapPath())); config.put(Const.CAPTCHA_SLIP_OFFSET, properties.getSlipOffset()); config.put(Const.CAPTCHA_AES_STATUS, String.valueOf(properties.getEnableAes())); config.put(Const.CAPTCHA_WATER_FONT, properties.getWaterFont()); @@ -98,8 +98,8 @@ public class BehaviorCaptchaAutoConfiguration { config.put(Const.CAPTCHA_FONT_SIZE, properties.getFontSize()); config.put(Const.CAPTCHA_FONT_STYLE, properties.getFontStyle()); config.put(Const.CAPTCHA_WORD_COUNT, 4); - if (StrUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:") || StrUtil.startWith(properties - .getPicClickBaseMapPath(), "classpath:")) { + if (CharSequenceUtil.startWith(properties.getJigsawBaseMapPath(), "classpath:") || CharSequenceUtil + .startWith(properties.getPicClickBaseMapPath(), "classpath:")) { // 自定义 resources 目录下初始化底图 config.put(Const.CAPTCHA_INIT_ORIGINAL, true); initializeBaseMap(properties.getJigsawBaseMapPath(), properties.getPicClickBaseMapPath()); diff --git a/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/core/GraphicCaptchaService.java b/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/core/GraphicCaptchaService.java index 55a75703..7aae8351 100644 --- a/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/core/GraphicCaptchaService.java +++ b/continew-starter-captcha/continew-starter-captcha-graphic/src/main/java/top/charles7c/continew/starter/captcha/graphic/core/GraphicCaptchaService.java @@ -17,7 +17,7 @@ package top.charles7c.continew.starter.captcha.graphic.core; import cn.hutool.core.util.ReflectUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import com.wf.captcha.base.Captcha; import top.charles7c.continew.starter.captcha.graphic.autoconfigure.GraphicCaptchaProperties; @@ -46,7 +46,7 @@ public class GraphicCaptchaService { Captcha captcha = ReflectUtil.newInstance(properties.getType().getCaptchaImpl(), properties .getWidth(), properties.getHeight()); captcha.setLen(properties.getLength()); - if (StrUtil.isNotBlank(properties.getFontName())) { + if (CharSequenceUtil.isNotBlank(properties.getFontName())) { captcha.setFont(new Font(properties.getFontName(), Font.PLAIN, properties.getFontSize())); } return captcha; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/GeneralPropertySourceFactory.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/GeneralPropertySourceFactory.java index 52d1be79..1cbb2ebb 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/GeneralPropertySourceFactory.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/GeneralPropertySourceFactory.java @@ -16,7 +16,7 @@ package top.charles7c.continew.starter.core.util; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import org.springframework.boot.env.YamlPropertySourceLoader; import org.springframework.core.env.PropertySource; import org.springframework.core.io.Resource; @@ -43,7 +43,7 @@ public class GeneralPropertySourceFactory extends DefaultPropertySourceFactory { EncodedResource encodedResource) throws IOException { Resource resource = encodedResource.getResource(); String resourceName = resource.getFilename(); - if (StrUtil.isNotBlank(resourceName) && StrUtil.endWithAny(resourceName, ".yml", ".yaml")) { + if (CharSequenceUtil.isNotBlank(resourceName) && CharSequenceUtil.endWithAny(resourceName, ".yml", ".yaml")) { return new YamlPropertySourceLoader().load(resourceName, resource).get(0); } return super.createPropertySource(name, encodedResource); diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java index c93e533d..d9ce8e80 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/IpUtils.java @@ -18,7 +18,7 @@ package top.charles7c.continew.starter.core.util; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.net.NetUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.extra.spring.SpringUtil; import cn.hutool.http.HtmlUtil; import net.dreamlu.mica.ip2region.core.Ip2regionSearcher; @@ -52,7 +52,7 @@ public class IpUtils { IpInfo ipInfo = ip2regionSearcher.memorySearch(ip); if (null != ipInfo) { Set regionSet = CollUtil.newLinkedHashSet(ipInfo.getAddress(), ipInfo.getIsp()); - regionSet.removeIf(StrUtil::isBlank); + regionSet.removeIf(CharSequenceUtil::isBlank); return String.join(StringConstants.SPACE, regionSet); } return null; diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/db/MetaUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/db/MetaUtils.java index 26311f34..6392f73b 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/db/MetaUtils.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/db/MetaUtils.java @@ -17,7 +17,7 @@ package top.charles7c.continew.starter.core.util.db; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.db.Db; import cn.hutool.db.Entity; import cn.hutool.db.meta.Column; @@ -61,7 +61,7 @@ public class MetaUtils { String querySql = "SHOW TABLE STATUS"; List tableEntityList; Db db = Db.use(dataSource); - if (StrUtil.isNotBlank(tableName)) { + if (CharSequenceUtil.isNotBlank(tableName)) { tableEntityList = db.query(String.format("%s WHERE NAME = ?", querySql), tableName); } else { tableEntityList = db.query(querySql); diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java index 84688aca..9a8c72f0 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/CheckUtils.java @@ -16,7 +16,7 @@ package top.charles7c.continew.starter.core.util.validate; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import top.charles7c.continew.starter.core.constant.StringConstants; import top.charles7c.continew.starter.core.exception.BusinessException; @@ -45,7 +45,7 @@ public class CheckUtils extends Validator { * @param fieldValue 字段值 */ public static void throwIfNotExists(Object obj, String entityName, String fieldName, Object fieldValue) { - String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue, StrUtil + String message = String.format("%s 为 [%s] 的 %s 记录已不存在", fieldName, fieldValue, CharSequenceUtil .replace(entityName, "DO", StringConstants.EMPTY)); throwIfNull(obj, message, EXCEPTION_TYPE); } @@ -58,7 +58,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfNull(Object obj, String template, Object... params) { - throwIfNull(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNull(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -69,7 +69,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfNotNull(Object obj, String template, Object... params) { - throwIfNotNull(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotNull(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -93,7 +93,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfEmpty(Object obj, String template, Object... params) { - throwIfEmpty(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfEmpty(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -104,7 +104,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfNotEmpty(Object obj, String template, Object... params) { - throwIfNotEmpty(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotEmpty(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -115,7 +115,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfBlank(CharSequence str, String template, Object... params) { - throwIfBlank(str, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfBlank(str, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -126,7 +126,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfNotBlank(CharSequence str, String template, Object... params) { - throwIfNotBlank(str, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotBlank(str, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -138,7 +138,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfEqual(Object obj1, Object obj2, String template, Object... params) { - throwIfEqual(obj1, obj2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfEqual(obj1, obj2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -150,7 +150,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfNotEqual(Object obj1, Object obj2, String template, Object... params) { - throwIfNotEqual(obj1, obj2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotEqual(obj1, obj2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -162,7 +162,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIfEqualIgnoreCase(CharSequence str1, CharSequence str2, String template, Object... params) { - throwIfEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfEqualIgnoreCase(str1, str2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -177,7 +177,7 @@ public class CheckUtils extends Validator { CharSequence str2, String template, Object... params) { - throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotEqualIgnoreCase(str1, str2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -188,7 +188,7 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIf(boolean condition, String template, Object... params) { - throwIf(condition, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIf(condition, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -199,6 +199,6 @@ public class CheckUtils extends Validator { * @param params 参数值 */ public static void throwIf(BooleanSupplier conditionSupplier, String template, Object... params) { - throwIf(conditionSupplier, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIf(conditionSupplier, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } } diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java index bf0777c3..2ec3a85d 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/ValidationUtils.java @@ -16,7 +16,7 @@ package top.charles7c.continew.starter.core.util.validate; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import top.charles7c.continew.starter.core.exception.BadRequestException; import java.util.function.BooleanSupplier; @@ -43,7 +43,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfNull(Object obj, String template, Object... params) { - throwIfNull(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNull(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -54,7 +54,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfNotNull(Object obj, String template, Object... params) { - throwIfNotNull(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotNull(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -65,7 +65,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfEmpty(Object obj, String template, Object... params) { - throwIfEmpty(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfEmpty(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -76,7 +76,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfNotEmpty(Object obj, String template, Object... params) { - throwIfNotEmpty(obj, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotEmpty(obj, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -87,7 +87,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfBlank(CharSequence str, String template, Object... params) { - throwIfBlank(str, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfBlank(str, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -98,7 +98,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfNotBlank(CharSequence str, String template, Object... params) { - throwIfNotBlank(str, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotBlank(str, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -110,7 +110,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfEqual(Object obj1, Object obj2, String template, Object... params) { - throwIfEqual(obj1, obj2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfEqual(obj1, obj2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -122,7 +122,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfNotEqual(Object obj1, Object obj2, String template, Object... params) { - throwIfNotEqual(obj1, obj2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotEqual(obj1, obj2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -134,7 +134,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIfEqualIgnoreCase(CharSequence str1, CharSequence str2, String template, Object... params) { - throwIfEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfEqualIgnoreCase(str1, str2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -149,7 +149,7 @@ public class ValidationUtils extends Validator { CharSequence str2, String template, Object... params) { - throwIfNotEqualIgnoreCase(str1, str2, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIfNotEqualIgnoreCase(str1, str2, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -160,7 +160,7 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIf(boolean condition, String template, Object... params) { - throwIf(condition, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIf(condition, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } /** @@ -171,6 +171,6 @@ public class ValidationUtils extends Validator { * @param params 参数值 */ public static void throwIf(BooleanSupplier conditionSupplier, String template, Object... params) { - throwIf(conditionSupplier, StrUtil.format(template, params), EXCEPTION_TYPE); + throwIf(conditionSupplier, CharSequenceUtil.format(template, params), EXCEPTION_TYPE); } } diff --git a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java index 15ed1eb0..45aa235b 100644 --- a/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java +++ b/continew-starter-core/src/main/java/top/charles7c/continew/starter/core/util/validate/Validator.java @@ -16,9 +16,9 @@ package top.charles7c.continew.starter.core.util.validate; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ReflectUtil; -import cn.hutool.core.util.StrUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -90,7 +90,7 @@ public class Validator { protected static void throwIfBlank(CharSequence str, String message, Class exceptionType) { - throwIf(StrUtil.isBlank(str), message, exceptionType); + throwIf(CharSequenceUtil.isBlank(str), message, exceptionType); } /** @@ -103,7 +103,7 @@ public class Validator { protected static void throwIfNotBlank(CharSequence str, String message, Class exceptionType) { - throwIf(StrUtil.isNotBlank(str), message, exceptionType); + throwIf(CharSequenceUtil.isNotBlank(str), message, exceptionType); } /** @@ -148,7 +148,7 @@ public class Validator { CharSequence str2, String message, Class exceptionType) { - throwIf(StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType); + throwIf(CharSequenceUtil.equalsIgnoreCase(str1, str2), message, exceptionType); } /** @@ -163,7 +163,7 @@ public class Validator { CharSequence str2, String message, Class exceptionType) { - throwIf(!StrUtil.equalsIgnoreCase(str1, str2), message, exceptionType); + throwIf(!CharSequenceUtil.equalsIgnoreCase(str1, str2), message, exceptionType); } /** diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java index 10262b81..dd9d0eac 100644 --- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java +++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/datapermission/DataPermissionHandlerImpl.java @@ -16,18 +16,9 @@ package top.charles7c.continew.starter.data.mybatis.plus.datapermission; -import java.lang.reflect.Method; -import java.util.Collections; -import java.util.Set; - -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.handler.DataPermissionHandler; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import top.charles7c.continew.starter.core.constant.StringConstants; - import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.Function; import net.sf.jsqlparser.expression.LongValue; @@ -42,6 +33,13 @@ import net.sf.jsqlparser.schema.Table; import net.sf.jsqlparser.statement.select.PlainSelect; import net.sf.jsqlparser.statement.select.SelectExpressionItem; import net.sf.jsqlparser.statement.select.SubSelect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import top.charles7c.continew.starter.core.constant.StringConstants; + +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.Set; /** * 数据权限处理器实现类 @@ -69,7 +67,7 @@ public class DataPermissionHandlerImpl implements DataPermissionHandler { for (Method method : methodArr) { DataPermission dataPermission = method.getAnnotation(DataPermission.class); String name = method.getName(); - if (null == dataPermission || !StrUtil.equalsAny(methodName, name, name + "_COUNT")) { + if (null == dataPermission || !CharSequenceUtil.equalsAny(methodName, name, name + "_COUNT")) { continue; } if (dataPermissionFilter.isFilter()) { diff --git a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryWrapperHelper.java b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryWrapperHelper.java index 4c9e7dc8..75cd9514 100644 --- a/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryWrapperHelper.java +++ b/continew-starter-data/continew-starter-data-mybatis-plus/src/main/java/top/charles7c/continew/starter/data/mybatis/plus/query/QueryWrapperHelper.java @@ -21,7 +21,7 @@ import org.slf4j.LoggerFactory; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import top.charles7c.continew.starter.core.exception.BadRequestException; import top.charles7c.continew.starter.core.util.ReflectUtils; @@ -117,7 +117,7 @@ public class QueryWrapperHelper { // 没有 @Query 注解,默认等值查询 Query queryAnnotation = field.getAnnotation(Query.class); if (null == queryAnnotation) { - return Collections.singletonList(q -> q.eq(StrUtil.toUnderlineCase(fieldName), fieldValue)); + return Collections.singletonList(q -> q.eq(CharSequenceUtil.toUnderlineCase(fieldName), fieldValue)); } // 解析单列查询 QueryType queryType = queryAnnotation.type(); @@ -125,7 +125,7 @@ public class QueryWrapperHelper { final int columnLength = ArrayUtil.length(columns); List>> consumers = new ArrayList<>(columnLength); if (columnLength <= 1) { - String columnName = columnLength == 1 ? columns[0] : StrUtil.toUnderlineCase(fieldName); + String columnName = columnLength == 1 ? columns[0] : CharSequenceUtil.toUnderlineCase(fieldName); parse(queryType, columnName, fieldValue, consumers); return consumers; } diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/controller/BaseController.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/controller/BaseController.java index ada4754e..3c615958 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/controller/BaseController.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/controller/BaseController.java @@ -18,7 +18,7 @@ package top.charles7c.continew.starter.extension.crud.controller; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.lang.tree.Tree; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.enums.ParameterIn; @@ -184,7 +184,8 @@ public abstract class BaseController, L, D, Q, private void checkPermission(Api api) { CrudRequestMapping crudRequestMapping = this.getClass().getDeclaredAnnotation(CrudRequestMapping.class); String path = crudRequestMapping.value(); - String permissionPrefix = String.join(StringConstants.COLON, StrUtil.splitTrim(path, StringConstants.SLASH)); + String permissionPrefix = String.join(StringConstants.COLON, CharSequenceUtil + .splitTrim(path, StringConstants.SLASH)); StpUtil.checkPermission(String.format("%s:%s", permissionPrefix, api.name().toLowerCase())); } } diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java index bc5fcbe2..566d5baa 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/PageQuery.java @@ -17,7 +17,7 @@ package top.charles7c.continew.starter.extension.crud.model.query; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -77,7 +77,7 @@ public class PageQuery extends SortQuery { for (Sort.Order order : pageSort) { OrderItem orderItem = new OrderItem(); orderItem.setAsc(order.isAscending()); - orderItem.setColumn(StrUtil.toUnderlineCase(order.getProperty())); + orderItem.setColumn(CharSequenceUtil.toUnderlineCase(order.getProperty())); mybatisPage.addOrder(orderItem); } } diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/SortQuery.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/SortQuery.java index 9eab7b21..f085dfb1 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/SortQuery.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/model/query/SortQuery.java @@ -17,7 +17,7 @@ package top.charles7c.continew.starter.extension.crud.model.query; import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import io.swagger.v3.oas.annotations.media.Schema; import org.springframework.data.domain.Sort; import top.charles7c.continew.starter.core.constant.StringConstants; @@ -56,10 +56,10 @@ public class SortQuery implements Serializable { } List orders = new ArrayList<>(sort.length); - if (StrUtil.contains(sort[0], StringConstants.COMMA)) { + if (CharSequenceUtil.contains(sort[0], StringConstants.COMMA)) { // e.g "sort=createTime,desc&sort=name,asc" for (String s : sort) { - List sortList = StrUtil.splitTrim(s, StringConstants.COMMA); + List sortList = CharSequenceUtil.splitTrim(s, StringConstants.COMMA); Sort.Order order = new Sort.Order(Sort.Direction.valueOf(sortList.get(1).toUpperCase()), sortList .get(0)); orders.add(order); diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/service/impl/BaseServiceImpl.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/service/impl/BaseServiceImpl.java index 6950746a..bc8906f4 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/service/impl/BaseServiceImpl.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/charles7c/continew/starter/extension/crud/service/impl/BaseServiceImpl.java @@ -25,7 +25,7 @@ import cn.hutool.core.lang.tree.Tree; import cn.hutool.core.lang.tree.TreeNodeConfig; import cn.hutool.core.util.ClassUtil; import cn.hutool.core.util.ReflectUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.extra.spring.SpringUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -107,15 +107,15 @@ public abstract class BaseServiceImpl, T extends BaseDO, // 构建树 return TreeUtils.build(list, treeNodeConfig, (node, tree) -> { // 转换器 - tree.setId(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.value()))); - tree.setParentId(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.parentIdKey()))); - tree.setName(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.nameKey()))); - tree.setWeight(ReflectUtil.invoke(node, StrUtil.genGetter(treeField.weightKey()))); + tree.setId(ReflectUtil.invoke(node, CharSequenceUtil.genGetter(treeField.value()))); + tree.setParentId(ReflectUtil.invoke(node, CharSequenceUtil.genGetter(treeField.parentIdKey()))); + tree.setName(ReflectUtil.invoke(node, CharSequenceUtil.genGetter(treeField.nameKey()))); + tree.setWeight(ReflectUtil.invoke(node, CharSequenceUtil.genGetter(treeField.weightKey()))); if (!isSimple) { List fieldList = ReflectUtils.getNonStaticFields(listClass); - fieldList.removeIf(f -> StrUtil.containsAnyIgnoreCase(f.getName(), treeField.value(), treeField + fieldList.removeIf(f -> CharSequenceUtil.containsAnyIgnoreCase(f.getName(), treeField.value(), treeField .parentIdKey(), treeField.nameKey(), treeField.weightKey(), treeField.childrenKey())); - fieldList.forEach(f -> tree.putExtra(f.getName(), ReflectUtil.invoke(node, StrUtil.genGetter(f + fieldList.forEach(f -> tree.putExtra(f.getName(), ReflectUtil.invoke(node, CharSequenceUtil.genGetter(f .getName())))); } }); @@ -224,7 +224,7 @@ public abstract class BaseServiceImpl, T extends BaseDO, String checkProperty; // 携带表别名则获取 . 后面的字段名 if (property.contains(StringConstants.DOT)) { - checkProperty = CollUtil.getLast(StrUtil.split(property, StringConstants.DOT)); + checkProperty = CollUtil.getLast(CharSequenceUtil.split(property, StringConstants.DOT)); } else { checkProperty = property; } @@ -232,7 +232,7 @@ public abstract class BaseServiceImpl, T extends BaseDO, .filter(field -> checkProperty.equals(field.getName())) .findFirst(); ValidationUtils.throwIf(optional.isEmpty(), "无效的排序字段 [{}]", property); - queryWrapper.orderBy(true, order.isAscending(), StrUtil.toUnderlineCase(property)); + queryWrapper.orderBy(true, order.isAscending(), CharSequenceUtil.toUnderlineCase(property)); } } } diff --git a/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java b/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java index 53b1396a..65a9fd89 100644 --- a/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java +++ b/continew-starter-log/continew-starter-log-common/src/main/java/top/charles7c/continew/starter/log/common/model/LogRequest.java @@ -16,7 +16,7 @@ package top.charles7c.continew.starter.log.common.model; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import org.springframework.http.HttpHeaders; import top.charles7c.continew.starter.core.util.IpUtils; import top.charles7c.continew.starter.log.common.enums.Include; @@ -99,7 +99,7 @@ public class LogRequest { .map(Map.Entry::getValue) .findFirst() .orElse(null); - if (StrUtil.isNotBlank(userAgentString)) { + if (CharSequenceUtil.isNotBlank(userAgentString)) { this.browser = (includes.contains(Include.BROWSER)) ? ServletUtils.getBrowser(userAgentString) : null; this.os = (includes.contains(Include.OS)) ? ServletUtils.getOs(userAgentString) : null; } diff --git a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/LogInterceptor.java b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/LogInterceptor.java index 77b6219b..605c3516 100644 --- a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/LogInterceptor.java +++ b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/LogInterceptor.java @@ -16,7 +16,7 @@ package top.charles7c.continew.starter.log.httptracepro.handler; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.extra.spring.SpringUtil; import com.alibaba.ttl.TransmittableThreadLocal; import io.swagger.v3.oas.annotations.Hidden; @@ -153,14 +153,14 @@ public class LogInterceptor implements HandlerInterceptor { */ private void logDescription(LogRecord logRecord, Log methodLog, HandlerMethod handlerMethod) { // 例如:@Log("新增部门") -> 新增部门 - if (null != methodLog && StrUtil.isNotBlank(methodLog.value())) { + if (null != methodLog && CharSequenceUtil.isNotBlank(methodLog.value())) { logRecord.setDescription(methodLog.value()); return; } // 例如:@Operation(summary="新增部门") -> 新增部门 Operation methodOperation = handlerMethod.getMethodAnnotation(Operation.class); if (null != methodOperation) { - logRecord.setDescription(StrUtil.blankToDefault(methodOperation.summary(), "请在该接口方法上指定日志描述")); + logRecord.setDescription(CharSequenceUtil.blankToDefault(methodOperation.summary(), "请在该接口方法上指定日志描述")); } } @@ -174,11 +174,11 @@ public class LogInterceptor implements HandlerInterceptor { */ private void logModule(LogRecord logRecord, Log methodLog, Log classLog, HandlerMethod handlerMethod) { // 例如:@Log(module = "部门管理") -> 部门管理 - if (null != methodLog && StrUtil.isNotBlank(methodLog.module())) { + if (null != methodLog && CharSequenceUtil.isNotBlank(methodLog.module())) { logRecord.setModule(methodLog.module()); return; } - if (null != classLog && StrUtil.isNotBlank(classLog.module())) { + if (null != classLog && CharSequenceUtil.isNotBlank(classLog.module())) { logRecord.setModule(classLog.module()); return; } @@ -186,7 +186,7 @@ public class LogInterceptor implements HandlerInterceptor { Tag classTag = handlerMethod.getBeanType().getDeclaredAnnotation(Tag.class); if (null != classTag) { String name = classTag.name(); - logRecord.setModule(StrUtil.blankToDefault(name, "请在该接口类上指定所属模块")); + logRecord.setModule(CharSequenceUtil.blankToDefault(name, "请在该接口类上指定所属模块")); } } diff --git a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java index 3c481d55..bc23fa44 100644 --- a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java +++ b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpRequest.java @@ -16,6 +16,7 @@ package top.charles7c.continew.starter.log.httptracepro.handler; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.servlet.JakartaServletUtil; import cn.hutool.json.JSONUtil; @@ -53,7 +54,7 @@ public final class RecordableServletHttpRequest implements RecordableHttpRequest @Override public URI getUrl() { String queryString = request.getQueryString(); - if (StrUtil.isBlank(queryString)) { + if (CharSequenceUtil.isBlank(queryString)) { return URI.create(request.getRequestURL().toString()); } try { @@ -89,7 +90,7 @@ public final class RecordableServletHttpRequest implements RecordableHttpRequest @Override public Map getParam() { String body = this.getBody(); - return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body) + return CharSequenceUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body) ? JSONUtil.toBean(body, Map.class) : Collections.unmodifiableMap(request.getParameterMap()); } diff --git a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java index 1c67b4c9..9347b906 100644 --- a/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java +++ b/continew-starter-log/continew-starter-log-httptrace-pro/src/main/java/top/charles7c/continew/starter/log/httptracepro/handler/RecordableServletHttpResponse.java @@ -16,6 +16,7 @@ package top.charles7c.continew.starter.log.httptracepro.handler; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import jakarta.servlet.http.HttpServletResponse; @@ -67,6 +68,6 @@ public final class RecordableServletHttpResponse implements RecordableHttpRespon @Override public Map getParam() { String body = this.getBody(); - return StrUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body) ? JSONUtil.toBean(body, Map.class) : null; + return CharSequenceUtil.isNotBlank(body) && JSONUtil.isTypeJSON(body) ? JSONUtil.toBean(body, Map.class) : null; } } diff --git a/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/util/MailUtils.java b/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/util/MailUtils.java index 3ef4f9d6..aa5b3dc9 100644 --- a/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/util/MailUtils.java +++ b/continew-starter-messaging/continew-starter-messaging-mail/src/main/java/top/charles7c/continew/starter/messaging/mail/util/MailUtils.java @@ -19,7 +19,7 @@ package top.charles7c.continew.starter.messaging.mail.util; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ArrayUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.extra.spring.SpringUtil; import jakarta.mail.MessagingException; import jakarta.mail.internet.MimeMessage; @@ -192,14 +192,14 @@ public class MailUtils { * @return 联系人列表 */ private static List splitAddress(String addresses) { - if (StrUtil.isBlank(addresses)) { + if (CharSequenceUtil.isBlank(addresses)) { return new ArrayList<>(0); } List result; - if (StrUtil.contains(addresses, StringConstants.COMMA)) { - result = StrUtil.splitTrim(addresses, StringConstants.COMMA); - } else if (StrUtil.contains(addresses, StringConstants.SEMICOLON)) { - result = StrUtil.splitTrim(addresses, StringConstants.SEMICOLON); + if (CharSequenceUtil.contains(addresses, StringConstants.COMMA)) { + result = CharSequenceUtil.splitTrim(addresses, StringConstants.COMMA); + } else if (CharSequenceUtil.contains(addresses, StringConstants.SEMICOLON)) { + result = CharSequenceUtil.splitTrim(addresses, StringConstants.SEMICOLON); } else { result = CollUtil.newArrayList(addresses); } diff --git a/continew-starter-security/continew-starter-security-password/src/main/java/top/charles7c/continew/starter/security/password/autoconfigure/PasswordEncoderAutoConfiguration.java b/continew-starter-security/continew-starter-security-password/src/main/java/top/charles7c/continew/starter/security/password/autoconfigure/PasswordEncoderAutoConfiguration.java index 82b0f40d..11c8a622 100644 --- a/continew-starter-security/continew-starter-security-password/src/main/java/top/charles7c/continew/starter/security/password/autoconfigure/PasswordEncoderAutoConfiguration.java +++ b/continew-starter-security/continew-starter-security-password/src/main/java/top/charles7c/continew/starter/security/password/autoconfigure/PasswordEncoderAutoConfiguration.java @@ -17,7 +17,7 @@ package top.charles7c.continew.starter.security.password.autoconfigure; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,7 +80,8 @@ public class PasswordEncoderAutoConfiguration { if (CollUtil.isNotEmpty(passwordEncoderList)) { passwordEncoderList.forEach(passwordEncoder -> { String simpleName = passwordEncoder.getClass().getSimpleName(); - encoders.put(StrUtil.removeSuffix(simpleName, "PasswordEncoder").toLowerCase(), passwordEncoder); + encoders.put(CharSequenceUtil.removeSuffix(simpleName, "PasswordEncoder") + .toLowerCase(), passwordEncoder); }); } String encodingId = properties.getEncodingId(); diff --git a/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java b/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java index de169686..929d395d 100644 --- a/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java +++ b/continew-starter-storage/continew-starter-storage-local/src/main/java/top/charles7c/continew/starter/storage/local/autoconfigure/LocalStorageAutoConfiguration.java @@ -16,7 +16,7 @@ package top.charles7c.continew.starter.storage.local.autoconfigure; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import jakarta.annotation.PostConstruct; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,10 +57,10 @@ public class LocalStorageAutoConfiguration implements WebMvcConfigurer { LocalStorageProperties.LocalStorageMapping mapping = mappingEntry.getValue(); String pathPattern = mapping.getPathPattern(); String location = mapping.getLocation(); - if (StrUtil.isBlank(location)) { + if (CharSequenceUtil.isBlank(location)) { throw new IllegalArgumentException(String.format("Path pattern [%s] location is null.", pathPattern)); } - registry.addResourceHandler(StrUtil.appendIfMissing(pathPattern, StringConstants.PATH_PATTERN)) + registry.addResourceHandler(CharSequenceUtil.appendIfMissing(pathPattern, StringConstants.PATH_PATTERN)) .addResourceLocations(!location.startsWith("file:") ? String.format("file:%s", this.format(location)) : this.format(location)) diff --git a/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java index 14e1d004..b8f62422 100644 --- a/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/exception/GlobalExceptionHandler.java @@ -18,7 +18,7 @@ package top.charles7c.continew.starter.web.autoconfigure.exception; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.NumberUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.ConstraintViolation; import jakarta.validation.ConstraintViolationException; @@ -99,7 +99,8 @@ public class GlobalExceptionHandler { @ExceptionHandler(MethodArgumentTypeMismatchException.class) public R handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e, HttpServletRequest request) { - String errorMsg = StrUtil.format("参数名:[{}],期望参数类型:[{}]", e.getName(), e.getParameter().getParameterType()); + String errorMsg = CharSequenceUtil.format("参数名:[{}],期望参数类型:[{}]", e.getName(), e.getParameter() + .getParameterType()); log.warn("请求地址 [{}],参数转换失败,{}。", request.getRequestURI(), errorMsg, e); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); } @@ -110,7 +111,7 @@ public class GlobalExceptionHandler { @ExceptionHandler(MaxUploadSizeExceededException.class) public R handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e, HttpServletRequest request) { log.warn("请求地址 [{}],上传文件失败,文件大小超过限制。", request.getRequestURI(), e); - String sizeLimit = StrUtil.subBetween(e.getMessage(), "The maximum size ", " for"); + String sizeLimit = CharSequenceUtil.subBetween(e.getMessage(), "The maximum size ", " for"); String errorMsg = String.format("请上传小于 %sMB 的文件", NumberUtil.parseLong(sizeLimit) / 1024 / 1024); return R.fail(HttpStatus.BAD_REQUEST.value(), errorMsg); } diff --git a/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/trace/TLogServletFilter.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/trace/TLogServletFilter.java index e070e5b7..c2eecc17 100644 --- a/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/trace/TLogServletFilter.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/autoconfigure/trace/TLogServletFilter.java @@ -16,7 +16,7 @@ package top.charles7c.continew.starter.web.autoconfigure.trace; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import com.yomahub.tlog.context.TLogContext; import jakarta.servlet.*; import jakarta.servlet.http.HttpServletRequest; @@ -53,7 +53,7 @@ public class TLogServletFilter implements Filter { TLogWebCommon.loadInstance().preHandle(httpServletRequest); // 把 traceId 放入 response 的 header,为了方便有些人有这样的需求,从前端拿整条链路的 traceId String headerName = traceProperties.getHeaderName(); - if (StrUtil.isNotBlank(headerName)) { + if (CharSequenceUtil.isNotBlank(headerName)) { httpServletResponse.addHeader(headerName, TLogContext.getTraceId()); } chain.doFilter(request, response); diff --git a/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/SpringWebUtils.java b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/SpringWebUtils.java index bc57f625..471c1a80 100644 --- a/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/SpringWebUtils.java +++ b/continew-starter-web/src/main/java/top/charles7c/continew/starter/web/util/SpringWebUtils.java @@ -17,7 +17,7 @@ package top.charles7c.continew.starter.web.util; import cn.hutool.core.util.ReflectUtil; -import cn.hutool.core.util.StrUtil; +import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.extra.spring.SpringUtil; import jakarta.servlet.ServletContext; import org.springframework.context.ApplicationContext; @@ -55,7 +55,7 @@ public class SpringWebUtils { .getFieldValue(resourceHandlerMapping, "handlerMap"); // 移除之前注册的映射 for (Map.Entry entry : handlerMap.entrySet()) { - String pathPattern = StrUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN); + String pathPattern = CharSequenceUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN); oldHandlerMap.remove(pathPattern); } } @@ -80,10 +80,10 @@ public class SpringWebUtils { final ResourceHandlerRegistry resourceHandlerRegistry = new ResourceHandlerRegistry(applicationContext, servletContext, contentNegotiationManager, urlPathHelper); for (Map.Entry entry : handlerMap.entrySet()) { // 移除之前注册的映射 - String pathPattern = StrUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN); + String pathPattern = CharSequenceUtil.appendIfMissing(entry.getKey(), StringConstants.PATH_PATTERN); oldHandlerMap.remove(pathPattern); // 重新注册映射 - String resourceLocations = StrUtil.appendIfMissing(entry.getValue(), StringConstants.SLASH); + String resourceLocations = CharSequenceUtil.appendIfMissing(entry.getValue(), StringConstants.SLASH); resourceHandlerRegistry.addResourceHandler(pathPattern).addResourceLocations("file:" + resourceLocations); } final Map additionalUrlMap = ReflectUtil