提交 75a88dae 作者: 方治民

feat: 修改集合非空判断方法名

上级 c4eac807
......@@ -91,7 +91,7 @@ public class Permissions {
)
)
.peek(item -> {
if (Commons.notEmpty(item.getChildren())) {
if (Commons.isNotEmpty(item.getChildren())) {
item.setChildren(sortMenuTreeVo(item.getChildren()));
}
})
......
......@@ -34,7 +34,7 @@ public class ValidateUtil {
@Cleanup
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Set<ConstraintViolation<T>> constraintViolations = factory.getValidator().validate(t, groups);
if (Commons.notEmpty(constraintViolations)) {
if (Commons.isNotEmpty(constraintViolations)) {
throw new ConstraintViolationException(constraintViolations);
}
}
......
/* (C) 2021 YiRing, Inc. */
package com.yiring.common.util;
import cn.hutool.core.collection.CollUtil;
import jakarta.servlet.http.HttpServletRequest;
import java.lang.reflect.Constructor;
import java.util.*;
import lombok.NonNull;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
......@@ -71,7 +71,7 @@ public class Commons {
* @param collection 集合
* @return 是否为空
*/
public boolean notEmpty(Collection<?> collection) {
public boolean isNotEmpty(Collection<?> collection) {
return collection != null && !collection.isEmpty();
}
......@@ -96,7 +96,7 @@ public class Commons {
*/
public <T> T transform(Object source, Class<T> type, String... ignoreProperties) {
try {
if (source == null) {
if (Objects.isNull(source)) {
return null;
}
......@@ -121,7 +121,7 @@ public class Commons {
* @param <S> 原类型集合
* @return 目标集合
*/
public <T, S> List<T> transform(@NonNull List<S> list, Class<T> type, String... ignoreProperties) {
public <T, S> List<T> transform(List<S> list, Class<T> type, String... ignoreProperties) {
return transform(list, type, null, ignoreProperties);
}
......@@ -137,12 +137,12 @@ public class Commons {
* @return 目标集合
*/
public <T, S> List<T> transform(
@NonNull List<S> list,
List<S> list,
Class<T> type,
CallbackFunction<S, T> fn,
String... ignoreProperties
) {
if (!notEmpty(list)) {
if (CollUtil.isEmpty(list)) {
return Collections.emptyList();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论