看一下需求:
在接收前端传参的时候,如果没有传数据,那么会是所有的属性都为 null,这时候进行判断参数是否为空 就不能单纯的 使用 param == null 来判断了
import java.lang.reflect.Field;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ObjectFildValidate {
public static final Logger logger = LoggerFactory.getLogger(ObjectFildValidate.class);
/**
*
* @Title: validateFild
* @Description: 检查指定对象的属性值是否为空
* @param: @param object
* @param: @param exclFild
* @param: @return
* @return: boolean
* @throws
*/
public static boolean validateFild(Object object){
boolean target = false;
for (Field f : object.getClass().getDeclaredFields()) {
f.setAccessible(true);
try {
String name = f.getName