diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/utils/EmptyUtil.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/utils/EmptyUtil.java new file mode 100644 index 0000000..c597c2a --- /dev/null +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/utils/EmptyUtil.java @@ -0,0 +1,119 @@ +// +// Source code recreated from a .class file by IntelliJ IDEA +// (powered by FernFlower decompiler) +// + +package shkd.sys.sys.utils; + +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Map; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.utils.StringUtils; +import kd.tmc.fbp.common.constant.Constants; + +public class EmptyUtil extends StringUtils { + public EmptyUtil() { + } + + public static boolean isEmpty(String s) { + return s == null || s.trim().length() == 0; + } + + public static boolean isNoEmpty(String string) { + return !isEmpty(string); + } + + public static boolean isEmpty(Long l) { + return l == null || l == 0L; + } + + public static boolean isNoEmpty(Long l) { + return !isEmpty(l); + } + + public static boolean isEmpty(BigDecimal l) { + return l == null || l.compareTo(Constants.ZERO) == 0; + } + + public static boolean isNoEmpty(BigDecimal o) { + return !isEmpty(o); + } + + public static boolean isEmpty(Integer l) { + return l == null || l == 0; + } + + public static boolean isNoEmpty(Integer l) { + return !isEmpty(l); + } + + public static boolean isEmpty(Object[] param) { + return param == null || param.length == 0 || isEmpty(param[0]); + } + + public static boolean isNoEmpty(Object[] param) { + return !isEmpty(param); + } + + public static boolean isEmpty(Collection coll) { + return coll == null || coll.isEmpty(); + } + + public static boolean isEmpty(DynamicObjectCollection coll) { + return coll == null || coll.isEmpty(); + } + + public static boolean isNoEmpty(DynamicObjectCollection coll) { + return !isEmpty(coll); + } + + public static boolean isEmpty(DynamicObject info) { + return info == null; + } + + public static boolean isNoEmpty(DynamicObject info) { + return !isEmpty(info); + } + + public static boolean isEmpty(Object obj) { + if (obj instanceof String) { + return isEmpty((String)obj); + } else if (obj instanceof Long) { + return isEmpty((Long)obj); + } else if (obj instanceof Integer) { + return isEmpty((Integer)obj); + } else if (obj instanceof BigDecimal) { + return isEmpty((BigDecimal)obj); + } else if (obj instanceof DynamicObjectCollection) { + return isEmpty((DynamicObjectCollection)obj); + } else if (obj instanceof Collection) { + return isEmpty((Collection)obj); + } else if (obj instanceof Object[]) { + return isEmpty((Object[])((Object[])obj)); + } else if (obj instanceof Map) { + return ((Map)obj).isEmpty(); + } else { + return obj == null; + } + } + + public static boolean isNoEmpty(Object o) { + return !isEmpty(o); + } + + public static boolean isAnyoneEmpty(Object... objects) { + Object[] var1 = objects; + int var2 = objects.length; + + for(int var3 = 0; var3 < var2; ++var3) { + Object object = var1[var3]; + if (isEmpty(object)) { + return true; + } + } + + return false; + } +}