|
|
|
@ -586,49 +586,44 @@ public class ObjectView implements View {
|
|
|
|
|
appendStringBuilder(buf, format("@%s[%s]", className, obj));
|
|
|
|
|
} else {
|
|
|
|
|
appendStringBuilder(buf, format("@%s[", className));
|
|
|
|
|
List<Field> fields = new ArrayList<Field>();
|
|
|
|
|
final List<Field> fields;
|
|
|
|
|
Class<?> objClass = obj.getClass();
|
|
|
|
|
if (GlobalOptions.printParentFields) {
|
|
|
|
|
fields = new ArrayList<Field>();
|
|
|
|
|
// 当父类为null的时候说明到达了最上层的父类(Object类).
|
|
|
|
|
while (objClass != null) {
|
|
|
|
|
for (Field field : objClass.getDeclaredFields()) {
|
|
|
|
|
fields.add(field);
|
|
|
|
|
}
|
|
|
|
|
fields.addAll(Arrays.asList(objClass.getDeclaredFields()));
|
|
|
|
|
objClass = objClass.getSuperclass();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (Field field : objClass.getDeclaredFields()) {
|
|
|
|
|
fields.add(field);
|
|
|
|
|
}
|
|
|
|
|
fields = new ArrayList<Field>(Arrays.asList(objClass.getDeclaredFields()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (null != fields) {
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
|
|
|
|
|
field.setAccessible(true);
|
|
|
|
|
for (Field field : fields) {
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
field.setAccessible(true);
|
|
|
|
|
|
|
|
|
|
final Object value = field.get(obj);
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
appendStringBuilder(buf, "\n");
|
|
|
|
|
for (int i = 0; i < deep+1; i++) {
|
|
|
|
|
appendStringBuilder(buf, TAB);
|
|
|
|
|
}
|
|
|
|
|
appendStringBuilder(buf, field.getName());
|
|
|
|
|
appendStringBuilder(buf, "=");
|
|
|
|
|
renderObject(value, deep + 1, expand, buf);
|
|
|
|
|
appendStringBuilder(buf, ",");
|
|
|
|
|
final Object value = field.get(obj);
|
|
|
|
|
|
|
|
|
|
} catch (ObjectTooLargeException t) {
|
|
|
|
|
buf.append("...");
|
|
|
|
|
break;
|
|
|
|
|
} catch (Throwable t) {
|
|
|
|
|
// ignore
|
|
|
|
|
appendStringBuilder(buf, "\n");
|
|
|
|
|
for (int i = 0; i < deep+1; i++) {
|
|
|
|
|
appendStringBuilder(buf, TAB);
|
|
|
|
|
}
|
|
|
|
|
}//for
|
|
|
|
|
appendStringBuilder(buf, "\n");
|
|
|
|
|
}//if
|
|
|
|
|
appendStringBuilder(buf, field.getName());
|
|
|
|
|
appendStringBuilder(buf, "=");
|
|
|
|
|
renderObject(value, deep + 1, expand, buf);
|
|
|
|
|
appendStringBuilder(buf, ",");
|
|
|
|
|
|
|
|
|
|
} catch (ObjectTooLargeException t) {
|
|
|
|
|
buf.append("...");
|
|
|
|
|
break;
|
|
|
|
|
} catch (Throwable t) {
|
|
|
|
|
// ignore
|
|
|
|
|
}
|
|
|
|
|
}//for
|
|
|
|
|
appendStringBuilder(buf, "\n");
|
|
|
|
|
for (int i = 0; i < deep; i++) {
|
|
|
|
|
appendStringBuilder(buf, TAB);
|
|
|
|
|
}
|
|
|
|
|