移除 hutool 高版本 StrUtil Api. (#35)

pull/84/head
chen.ma 3 years ago
parent c94e882a0d
commit 31cba738ed

@ -26,11 +26,6 @@
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>

@ -0,0 +1,22 @@
package cn.hippo4j.common.toolkit;
/**
* Array util.
*
* @author chen.ma
* @date 2021/12/30 21:42
*/
public class ArrayUtil {
/**
* Is empty.
*
* @param array
* @param <T>
* @return
*/
public static <T> boolean isEmpty(T[] array) {
return array == null || array.length == 0;
}
}

@ -1,7 +1,5 @@
package cn.hippo4j.common.toolkit;
import cn.hutool.core.util.ArrayUtil;
/**
* String util.
*

@ -12,11 +12,11 @@ import cn.hippo4j.starter.toolkit.thread.QueueTypeEnum;
import cn.hippo4j.starter.toolkit.thread.RejectedTypeEnum;
import cn.hippo4j.starter.wrapper.DynamicThreadPoolWrapper;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.taobao.api.ApiException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -59,7 +59,7 @@ public class DingSendMessageHandler implements SendMessageHandler {
}
private void dingAlarmSendMessage(NotifyDTO notifyConfig, DynamicThreadPoolExecutor pool) {
List<String> receives = StrUtil.split(notifyConfig.getReceives(), ',');
String[] receives = notifyConfig.getReceives().split(",");
String afterReceives = Joiner.on(", @").join(receives);
BlockingQueue<Runnable> queue = pool.getQueue();
@ -107,7 +107,7 @@ public class DingSendMessageHandler implements SendMessageHandler {
DateUtil.now()
);
execute(notifyConfig, DingAlarmConstants.DING_ALARM_TITLE, text, receives);
execute(notifyConfig, DingAlarmConstants.DING_ALARM_TITLE, text, Lists.newArrayList(receives));
}
private void dingChangeSendMessage(NotifyDTO notifyConfig, PoolParameterInfo parameter) {
@ -118,7 +118,7 @@ public class DingSendMessageHandler implements SendMessageHandler {
return;
}
List<String> receives = StrUtil.split(notifyConfig.getReceives(), ',');
String[] receives = notifyConfig.getReceives().split(",");
String afterReceives = Joiner.on(", @").join(receives);
ThreadPoolExecutor customPool = poolWrap.getExecutor();
@ -156,7 +156,7 @@ public class DingSendMessageHandler implements SendMessageHandler {
DateUtil.now()
);
execute(notifyConfig, DingAlarmConstants.DING_NOTICE_TITLE, text, receives);
execute(notifyConfig, DingAlarmConstants.DING_NOTICE_TITLE, text, Lists.newArrayList(receives));
}
private void execute(NotifyDTO notifyConfig, String title, String text, List<String> mobiles) {

@ -3,6 +3,7 @@ package cn.hippo4j.starter.alarm.lark;
import cn.hippo4j.common.enums.EnableEnum;
import cn.hippo4j.common.model.InstanceInfo;
import cn.hippo4j.common.model.PoolParameterInfo;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.starter.alarm.NotifyDTO;
import cn.hippo4j.starter.alarm.NotifyPlatformEnum;
import cn.hippo4j.starter.alarm.SendMessageHandler;
@ -169,7 +170,7 @@ public class LarkSendMessageHandler implements SendMessageHandler {
}
private String getReceives(NotifyDTO notifyConfig) {
if (StrUtil.isBlank(notifyConfig.getReceives())) {
if (StringUtil.isBlank(notifyConfig.getReceives())) {
return "";
}
return Arrays.stream(notifyConfig.getReceives().split(","))

@ -13,7 +13,6 @@ import cn.hippo4j.starter.toolkit.thread.QueueTypeEnum;
import cn.hippo4j.starter.toolkit.thread.RejectedTypeEnum;
import cn.hippo4j.starter.wrapper.DynamicThreadPoolWrapper;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.google.common.base.Joiner;
import lombok.AllArgsConstructor;
@ -21,7 +20,6 @@ import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@ -49,7 +47,7 @@ public class WeChatSendMessageHandler implements SendMessageHandler {
@Override
public void sendAlarmMessage(NotifyDTO notifyConfig, DynamicThreadPoolExecutor pool) {
List<String> receives = StrUtil.split(notifyConfig.getReceives(), ',');
String[] receives = notifyConfig.getReceives().split(",");
String afterReceives = Joiner.on(", @").join(receives);
BlockingQueue<Runnable> queue = pool.getQueue();
@ -109,7 +107,7 @@ public class WeChatSendMessageHandler implements SendMessageHandler {
return;
}
List<String> receives = StrUtil.split(notifyConfig.getReceives(), ',');
String[] receives = notifyConfig.getReceives().split(",");
String afterReceives = Joiner.on("><@").join(receives);
ThreadPoolExecutor customPool = poolWrap.getExecutor();

@ -9,7 +9,6 @@ import cn.hippo4j.starter.remote.HttpAgent;
import cn.hippo4j.starter.remote.ServerHealthCheck;
import cn.hippo4j.starter.toolkit.thread.ThreadFactoryBuilder;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
@ -105,8 +104,8 @@ public class ClientWorker {
cacheMap.forEach((key, val) -> cacheDataList.add(val));
List<String> changedTpIds = checkUpdateDataIds(cacheDataList, inInitializingCacheList);
for (String each : changedTpIds) {
String[] keys = StrUtil.split(each, GROUP_KEY_DELIMITER);
for (String groupKey : changedTpIds) {
String[] keys = groupKey.split(GROUP_KEY_DELIMITER);
String tpId = keys[0];
String itemId = keys[1];
String namespace = keys[2];

@ -1,8 +1,8 @@
package cn.hippo4j.starter.enable;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.starter.config.BootstrapProperties;
import cn.hippo4j.starter.core.ConfigEmptyException;
import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@ -24,7 +24,7 @@ public class BeforeCheckConfiguration {
ConfigurableEnvironment environment) {
if (properties != null) {
String username = properties.getUsername();
if (StrUtil.isBlank(username)) {
if (StringUtil.isBlank(username)) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool username is empty.",
"Please check whether the [spring.dynamic.thread-pool.username] configuration is empty or an empty string."
@ -32,7 +32,7 @@ public class BeforeCheckConfiguration {
}
String password = properties.getPassword();
if (StrUtil.isBlank(password)) {
if (StringUtil.isBlank(password)) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool password is empty.",
"Please check whether the [spring.dynamic.thread-pool.password] configuration is empty or an empty string."
@ -40,7 +40,7 @@ public class BeforeCheckConfiguration {
}
String namespace = properties.getNamespace();
if (StrUtil.isBlank(namespace)) {
if (StringUtil.isBlank(namespace)) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool namespace is empty.",
"Please check whether the [spring.dynamic.thread-pool.namespace] configuration is empty or an empty string."
@ -48,7 +48,7 @@ public class BeforeCheckConfiguration {
}
String itemId = properties.getItemId();
if (StrUtil.isBlank(itemId)) {
if (StringUtil.isBlank(itemId)) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool item id is empty.",
"Please check whether the [spring.dynamic.thread-pool.item-id] configuration is empty or an empty string."
@ -56,7 +56,7 @@ public class BeforeCheckConfiguration {
}
String serverAddr = properties.getServerAddr();
if (StrUtil.isBlank(serverAddr)) {
if (StringUtil.isBlank(serverAddr)) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool server addr is empty.",
"Please check whether the [spring.dynamic.thread-pool.server-addr] configuration is empty or an empty string."
@ -64,7 +64,7 @@ public class BeforeCheckConfiguration {
}
String applicationName = environment.getProperty("spring.application.name");
if (StrUtil.isBlank(applicationName)) {
if (StringUtil.isBlank(applicationName)) {
throw new ConfigEmptyException(
"Web server failed to start. The dynamic thread pool application name is empty.",
"Please check whether the [spring.application.name] configuration is empty or an empty string."

@ -31,7 +31,7 @@
<dozer.version>6.5.0</dozer.version>
<guava.version>29.0-jre</guava.version>
<okhttp3.version>3.8.1</okhttp3.version>
<hutool-core.version>5.4.7</hutool-core.version>
<hutool-all.version>5.4.7</hutool-all.version>
<fastjson.version>1.2.75</fastjson.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<hibernate-validator.version>6.1.5.Final</hibernate-validator.version>
@ -86,7 +86,7 @@
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-core.version}</version>
<version>${hutool-all.version}</version>
</dependency>
<dependency>

Loading…
Cancel
Save