/**
* //处理空数组
* @param object
* @throws Exception
*/
public static void getObjectValue(Object object) throws Exception {
if (object != null) {//if (object!=null ) ----begin
// 拿到该类
Class<?> clz = object.getClass();
// 获取实体类的所有属性,返回Field数组
Field[] fields = clz.getDeclaredFields();
for (Field field : fields) {// --for() begin
if(field.getGenericType().toString().contains("java.util.List")){
if(field.get(object)==null){
field.setAccessible(true);
field.set(object,new ArrayList<>());
// System.out.println("属性名:" + field.getName());
// System.out.println("属性类型:" + field.getGenericType());
// System.out.println("属性值:" + String.valueOf(field.get(object)));
}
}
}
}
}