fix sc command render fields problem. close #956

pull/966/head
hengyunabc 5 years ago
parent cc078bf5d6
commit 3892fb12c6

@ -56,7 +56,7 @@ public class ClassUtils {
.row(label("classLoaderHash").style(Decoration.bold.bold()), label(StringUtils.classLoaderHash(clazz))); .row(label("classLoaderHash").style(Decoration.bold.bold()), label(StringUtils.classLoaderHash(clazz)));
if (isPrintField) { if (isPrintField) {
table.row(label("fields"), TypeRenderUtils.drawField(clazz, expand)); table.row(label("fields").style(Decoration.bold.bold()), TypeRenderUtils.drawField(clazz, expand));
} }
return table; return table;
} }

@ -98,17 +98,17 @@ public class TypeRenderUtils {
} }
public static Element drawField(Class<?> clazz, Integer expand) { public static Element drawField(Class<?> clazz, Integer expand) {
TableElement fieldsTable = new TableElement().leftCellPadding(0).rightCellPadding(0); TableElement fieldsTable = new TableElement(1).leftCellPadding(0).rightCellPadding(0);
Field[] fields = clazz.getDeclaredFields(); Field[] fields = clazz.getDeclaredFields();
if (fields == null || fields.length == 0) { if (fields == null || fields.length == 0) {
return fieldsTable; return fieldsTable;
} }
for (Field field : fields) { for (Field field : fields) {
TableElement fieldTable = new TableElement().leftCellPadding(0).rightCellPadding(0); TableElement fieldTable = new TableElement().leftCellPadding(0).rightCellPadding(1);
fieldTable.row("modifier", StringUtils.modifier(field.getModifiers(), ',')) fieldTable.row("name", field.getName())
.row("type", StringUtils.classname(field.getType())) .row("type", StringUtils.classname(field.getType()))
.row("name", field.getName()); .row("modifier", StringUtils.modifier(field.getModifiers(), ','));
Annotation[] annotations = field.getAnnotations(); Annotation[] annotations = field.getAnnotations();
if (annotations != null && annotations.length > 0) { if (annotations != null && annotations.length > 0) {

Loading…
Cancel
Save