ef1b0ecdcf3ec7c6ecfd4b849774fbc6926b4849.svn-base 1008 B

12345678910111213141516171819202122232425262728
  1. package cn.com.goldenwater.dcproj.utils;
  2. import cn.com.goldenwater.dcproj.annotation.ExcelImport;
  3. import java.lang.reflect.Field;
  4. public class ExcelNotNullVerify<T> extends ExcelVerifyParameter<T>{
  5. @Override
  6. public void doverify() throws Exception {
  7. for (VerifyItem<T> tVerifyItem : collection.VerifyItemList) {
  8. T obj = tVerifyItem.getObj();
  9. Field[] declaredFields = obj.getClass().getDeclaredFields();
  10. for (Field f : declaredFields) {
  11. ExcelImport annotation = f.getAnnotation(ExcelImport.class);
  12. if(annotation != null && annotation.notNull() == true) {
  13. f.setAccessible(true);
  14. Object o = f.get(obj);
  15. if(o == null || "".equals(o)){
  16. tVerifyItem.setTrueOrFalse(false);
  17. tVerifyItem.addMsg("【" + annotation.titleName() + "】没有填写 ");
  18. }
  19. }
  20. }
  21. }
  22. }
  23. }