| 12345678910111213141516171819202122232425262728 |
- package cn.com.goldenwater.dcproj.utils;
- import cn.com.goldenwater.dcproj.annotation.ExcelImport;
- import java.lang.reflect.Field;
- public class ExcelNotNullVerify<T> extends ExcelVerifyParameter<T>{
- @Override
- public void doverify() throws Exception {
- for (VerifyItem<T> 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() + "】没有填写 ");
- }
- }
- }
- }
- }
- }
|