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

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

@ -1,5 +1,7 @@
package cn.hippo4j.common.toolkit;
import cn.hutool.core.util.ArrayUtil;
/**
* String util.
*
@ -18,7 +20,7 @@ public class StringUtil {
* @param str
* @return
*/
public static boolean isBlank(String str) {
public static boolean isBlank(CharSequence str) {
int length;
if ((str == null) || ((length = str.length()) == 0)) {
@ -37,16 +39,65 @@ public class StringUtil {
return true;
}
/**
* Is empty.
*
* @param str
* @return
*/
public static boolean isEmpty(CharSequence str) {
return str == null || str.length() == 0;
}
/**
* Is not empty.
*
* @param str
* @return
*/
public static boolean isNotEmpty(CharSequence str) {
return !isEmpty(str);
}
/**
* Is not blank.
*
* @param str
* @return
*/
public static boolean isNotBlank(String str) {
public static boolean isNotBlank(CharSequence str) {
return isBlank(str) == false;
}
/**
* Is all not empty.
*
* @param args
* @return
*/
public static boolean isAllNotEmpty(CharSequence... args) {
return false == hasEmpty(args);
}
/**
* Has empty.
*
* @param strList
* @return
*/
public static boolean hasEmpty(CharSequence... strList) {
if (ArrayUtil.isEmpty(strList)) {
return true;
}
for (CharSequence str : strList) {
if (isEmpty(str)) {
return true;
}
}
return false;
}
/**
* To underline case.
*

@ -3,10 +3,10 @@ package cn.hippo4j.starter.security;
import cn.hippo4j.common.constant.Constants;
import cn.hippo4j.common.model.TokenInfo;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.common.toolkit.StringUtil;
import cn.hippo4j.common.web.base.Result;
import cn.hippo4j.starter.config.BootstrapProperties;
import cn.hippo4j.starter.toolkit.HttpClientUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import java.util.HashMap;
@ -66,7 +66,7 @@ public class SecurityProxy {
}
public boolean applyToken(String server) {
if (StrUtil.isAllNotBlank(username, password)) {
if (StringUtil.isAllNotEmpty(username, password)) {
String url = server + APPLY_TOKEN_URL;
Map<String, String> bodyMap = new HashMap(2);

Loading…
Cancel
Save