Issue #3132 improve dump readability

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2018-11-22 18:08:46 +01:00
parent 0900d5ad75
commit fc0d2569ef
1 changed files with 13 additions and 14 deletions

View File

@ -100,7 +100,7 @@ public interface Dumpable
} }
catch (Throwable th) catch (Throwable th)
{ {
out.append("=>").append(th.toString()).append("\n"); out.append("=> ").append(th.toString()).append("\n");
} }
} }
@ -134,12 +134,12 @@ public interface Dumpable
for (Iterator<Object> i = container.getBeans().iterator(); i.hasNext();) for (Iterator<Object> i = container.getBeans().iterator(); i.hasNext();)
{ {
Object bean = i.next(); Object bean = i.next();
String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " "); String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " ");
if (bean instanceof LifeCycle) if (bean instanceof LifeCycle)
{ {
if (container.isManaged(bean)) if (container.isManaged(bean))
{ {
out.append(indent).append("+="); out.append(indent).append("+= ");
if (bean instanceof Dumpable) if (bean instanceof Dumpable)
((Dumpable)bean).dump(out,nextIndent); ((Dumpable)bean).dump(out,nextIndent);
else else
@ -147,7 +147,7 @@ public interface Dumpable
} }
else if (containerLifeCycle != null && containerLifeCycle.isAuto(bean)) else if (containerLifeCycle != null && containerLifeCycle.isAuto(bean))
{ {
out.append(indent).append("+?"); out.append(indent).append("+? ");
if (bean instanceof Dumpable) if (bean instanceof Dumpable)
((Dumpable)bean).dump(out,nextIndent); ((Dumpable)bean).dump(out,nextIndent);
else else
@ -155,18 +155,18 @@ public interface Dumpable
} }
else else
{ {
out.append(indent).append("+~"); out.append(indent).append("+~ ");
dumpObject(out, bean); dumpObject(out, bean);
} }
} }
else if (containerLifeCycle != null && containerLifeCycle.isUnmanaged(bean)) else if (containerLifeCycle != null && containerLifeCycle.isUnmanaged(bean))
{ {
out.append(indent).append("+~"); out.append(indent).append("+~ ");
dumpObject(out, bean); dumpObject(out, bean);
} }
else else
{ {
out.append(indent).append("+-"); out.append(indent).append("+- ");
if (bean instanceof Dumpable) if (bean instanceof Dumpable)
((Dumpable)bean).dump(out,nextIndent); ((Dumpable)bean).dump(out,nextIndent);
else else
@ -179,8 +179,8 @@ public interface Dumpable
for (Iterator i = ((Iterable<?>)object).iterator(); i.hasNext();) for (Iterator i = ((Iterable<?>)object).iterator(); i.hasNext();)
{ {
Object item = i.next(); Object item = i.next();
String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " "); String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " ");
out.append(indent).append("+:"); out.append(indent).append("+: ");
if (item instanceof Dumpable) if (item instanceof Dumpable)
((Dumpable)item).dump(out,nextIndent); ((Dumpable)item).dump(out,nextIndent);
else else
@ -192,8 +192,8 @@ public interface Dumpable
for (Iterator<? extends Map.Entry<?, ?>> i = ((Map<?,?>)object).entrySet().iterator(); i.hasNext();) for (Iterator<? extends Map.Entry<?, ?>> i = ((Map<?,?>)object).entrySet().iterator(); i.hasNext();)
{ {
Map.Entry entry = i.next(); Map.Entry entry = i.next();
String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " "); String nextIndent = indent + ((i.hasNext() || size>0) ? "| " : " ");
out.append(indent).append("+@").append(String.valueOf(entry.getKey())).append('='); out.append(indent).append("+@ ").append(String.valueOf(entry.getKey())).append('=');
Object item = entry.getValue(); Object item = entry.getValue();
if (item instanceof Dumpable) if (item instanceof Dumpable)
((Dumpable)item).dump(out,nextIndent); ((Dumpable)item).dump(out,nextIndent);
@ -209,13 +209,12 @@ public interface Dumpable
for (Object item : extraChildren) for (Object item : extraChildren)
{ {
i++; i++;
String nextIndent = indent + (i<size ? "| " : " "); String nextIndent = indent + (i<size ? "| " : " ");
out.append(indent).append("+>"); out.append(indent).append("+> ");
if (item instanceof Dumpable) if (item instanceof Dumpable)
((Dumpable)item).dump(out,nextIndent); ((Dumpable)item).dump(out,nextIndent);
else else
dumpObjects(out, nextIndent, item); dumpObjects(out, nextIndent, item);
} }
} }
} }