数据判空工具类
package com.tool.commons;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class ICommons {
public ICommons() {
}
public static boolean isNullOrEmpty(String s) {
return s == null || s.trim().equals("");
}
public static boolean isNullOrEmpty(Date date) {
return date == null;
}
public static boolean isNullOrEmpty(Object obj) {
return obj == null ? true : isNullOrEmpty(obj.toString());
}
public static boolean isNullOrEmpty(Long l) {
return isNullOrEmpty(l, true);
}
public static boolean isNullOrEmpty(Long l, Boolean judgeZero) {
if (l == null) {
return true;
} else {
return judgeZero && l == 0L;
}
}
public static boolean isNullOrEmpty(Integer i) {
return isNullOrEmpty(i, true);
}
public static boolean isNullOrEmpty(Integer i, Boolean judgeZero) {
if (i == null) {
return true;
} else {
return judgeZero && i == 0;
}
}
public static boolean isNullOrEmpty(Double d) {
return isNullOrEmpty(d, true);
}
public static boolean isNullOrEmpty(Double d, Boolean judgeZero) {
if (d != null && d != 0.0D) {
return judgeZero && d == 0.0D;
} else {
return true;
}
}
public static boolean isNullOrEmpty(List l) {
return l == null || l.size() == 0;
}
public static Boolean isNullOrEmpty(Map map) {
return map != null && map.size() != 0 ? false : true;
}
public static String deCode(String s) {
try {
return URLDecoder.decode(s, "UTF-8");
} catch (UnsupportedEncodingException var2) {
return null;
}
}
}