package cn.com.goldenwater.dcproj.utils; import cn.com.goldenwater.dcproj.annotation.ExcelImport; import java.lang.reflect.Field; public class ExcelNotNullVerify extends ExcelVerifyParameter{ @Override public void doverify() throws Exception { for (VerifyItem tVerifyItem : collection.VerifyItemList) { T obj = tVerifyItem.getObj(); Field[] declaredFields = obj.getClass().getDeclaredFields(); for (Field f : declaredFields) { ExcelImport annotation = f.getAnnotation(ExcelImport.class); if(annotation != null && annotation.notNull() == true) { f.setAccessible(true); Object o = f.get(obj); if(o == null || "".equals(o)){ tVerifyItem.setTrueOrFalse(false); tVerifyItem.addMsg("【" + annotation.titleName() + "】没有填写 "); } } } } } }