private void appendDependencies(DependencyNode n, EditorModel m, StringBuilder sb) { List<DependencyNode> incoming = m.incomingDependencies(this); sb.append("Used from ").append(formatIds(incoming)).append("\n"); }
/** * Returns a descriptive string for a given object. * * @param o object to drive into. * @return */ @SuppressWarnings("unchecked") private void appendDescription( EditorModel m, Object o, StringBuilder sb, int depth, int maxDepth) { if (maxDepth == depth) { return; } String indent = new String(new char[depth * 2]).replace('\0', ' '); if (o == null) { sb.append("(null)"); return; } String id = "" + m.getEditorId(o); String cname = o.getClass().getSimpleName(); if (o instanceof BasicElement) { sb.append(indent + cname + " (" + id + ")" + "\n"); if (depth != maxDepth) { appendDependencies(this, m, sb); } appendParams(m, o, sb, depth, maxDepth); } else if (o instanceof EAdList) { EAdList target = (EAdList) o; sb.append(indent + cname + " (" + id + ")" + "\n"); if (target.size() == 0) { sb.append(indent + " (empty)\n"); } else if (depth == maxDepth - 1) { sb.append(indent + " (" + target.size() + " elements inside)\n"); } else { for (int i = 0; i < target.size(); i++) { // visit all children-values of this list Object inner = target.get(i); if (inner != null) { appendDescription(m, inner, sb, depth + 1, maxDepth); } } } } else if (o instanceof EAdMap) { EAdMap<?> target = (EAdMap<?>) o; sb.append(indent + cname + " (" + id + ")" + "\n"); int i = 0; if (target.size() == 0) { sb.append(indent + " (empty)\n"); } else if (depth == maxDepth - 1) { sb.append(indent + " (" + target.size() + " elements inside)\n"); } else { for (Map.Entry<?, ?> e : target.entrySet()) { if (e.getKey() != null) { appendDescription(m, e.getKey(), sb, depth + 1, maxDepth); } sb.append(indent + " -m->\n"); if (e.getValue() != null) { appendDescription(m, e.getValue(), sb, depth + 1, maxDepth); } i++; } } } else if (o instanceof EAdParam) { sb.append(indent + ((EAdParam) o).toStringData()); } else if (o instanceof AssetDescriptor) { sb.append(indent + "asset" + " (" + id + "): " + ((AssetDescriptor) o).getId() + "\n"); appendParams(m, o, sb, depth, maxDepth); if (depth != maxDepth) { appendDependencies(this, m, sb); } } else if (o instanceof Class) { sb.append(indent + ((Class<?>) o).getName() + "\n"); } else { sb.append(indent + " (" + cname + "~" + o.toString() + ")\n"); } }