Explorar el Código

对于没有@Excel的字段校验,其名字直接使用字段名

4.1.3.A
Hugh Gao hace 6 años
padre
commit
a353e568f7
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. +6
    -2
      easypoi-base/src/main/java/cn/afterturn/easypoi/util/PoiValidationUtil.java

+ 6
- 2
easypoi-base/src/main/java/cn/afterturn/easypoi/util/PoiValidationUtil.java Ver fichero

@@ -65,13 +65,17 @@ public class PoiValidationUtil {
if (superClass != null) {
fields.addAll(Arrays.asList(superClass.getDeclaredFields()));
}
String name = null;
for (Field field: fields) {
if (field.getName().equals(fieldName) && field.isAnnotationPresent(Excel.class)) {
builder.append(field.getAnnotation(Excel.class).name());
name = field.getAnnotation(Excel.class).name();
break;
}
}
builder.append(constraintViolation.getMessage()).append(",");
if (name == null) {
name = fieldName;
}
builder.append(name).append(constraintViolation.getMessage()).append(",");
}
return builder.substring(0, builder.length() - 1);
}


Cargando…
Cancelar
Guardar