collect3.forEach((key, value) -> {
System.out.println(key);
Field[] declaredFields = value.getClass().getDeclaredFields();
System.out.println(declaredFields);
for (Field f: declaredFields) {
String fUpName = f.getName().substring(0, 1).toUpperCase();
String objGetName = "get" + fUpName + f.getName().substring(1);
try {
Method method = value.getClass().getMethod(objGetName, new Class[] {});
Object objValue =method.invoke(value, new Object[] {});
System.out.println(method + ":" + objValue);
if (objValue instanceof Float) {
}
if (objValue instanceof Integer) {
}
if (objValue instanceof List) {
}
if (objValue instanceof Serializable) {
}
if (objValue.getClass().equals(Integer.class)) {
}
if (objValue.getClass().equals(Serializable.class)) {
}
if (objValue.getClass().equals(Float.class)) {
}
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
});
tips:在spring boot中运行成功