package com.ydtech.modules.inv.utils; import java.lang.reflect.Field; public class ImportObjectUtils { public static boolean allNull(Object obj) { if (obj == null) { return true; } Field[] fields = obj.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true); // 使私有属性也可以访问 try { if (field.get(obj) != null) { return false; } } catch (IllegalAccessException e) { throw new RuntimeException(e); } } return true; } }