public class demo1 {
public static void main(String[] args) throws IllegalAccessException {
Student student = new Student();
for (Field f : student.getClass().getDeclaredFields()) {
f.setAccessible(true);
if (ObjectUtil.isEmpty(f.get(student))) {
Console.error("基础信息{" + f.getName() + "}不能为空!");
}
}
}
}
@Data
public class Student {
private String name;
private Integer age;
private Integer group;
public Student(String name, Integer age, Integer group) {
this.name = name;
this.age = age;
this.group = group;
}
public Student() {
super();
}
}