/** * Formats the current {@code Coupled} and all its children as a tree in the given tree table node. * This method is used for {@link StorageConnector#toString()} implementation only and may change * in any future version. * * @param appendTo where to write name, value and children. * @param views reference to the {@link StorageConnector#views} map. Will be read only. */ @Debug final void append(final TreeTable.Node appendTo, final Map<Class<?>, Coupled> views) { Class<?> type = null; for (final Map.Entry<Class<?>, Coupled> entry : views.entrySet()) { if (entry.getValue() == this) { final Class<?> t = Classes.findCommonClass(type, entry.getKey()); if (t != Object.class) type = t; } } appendTo.setValue(TableColumn.NAME, Classes.getShortName(type)); appendTo.setValue(TableColumn.VALUE, Classes.getShortClassName(view)); if (wrappedBy != null) { for (final Coupled c : wrappedBy) { c.append(appendTo.newChild(), views); } } } }
/** * Formats the current {@code Coupled} and all its children as a tree in the given tree table node. * This method is used for {@link StorageConnector#toString()} implementation only and may change * in any future version. * * @param appendTo where to write name, value and children. * @param views reference to the {@link StorageConnector#views} map. Will be read only. */ @Debug final void append(final TreeTable.Node appendTo, final Map<Class<?>, Coupled> views) { Class<?> type = null; for (final Map.Entry<Class<?>, Coupled> entry : views.entrySet()) { if (entry.getValue() == this) { final Class<?> t = Classes.findCommonClass(type, entry.getKey()); if (t != Object.class) type = t; } } appendTo.setValue(TableColumn.NAME, Classes.getShortName(type)); appendTo.setValue(TableColumn.VALUE, Classes.getShortClassName(view)); if (wrappedBy != null) { for (final Coupled c : wrappedBy) { c.append(appendTo.newChild(), views); } } } }
/** * Returns a string representation of this {@code StorageConnector} for debugging purpose. * This string representation is for debugging purpose only and may change in any future version. * * @return a string representation of this {@code StorageConnector} for debugging purpose. */ @Override public String toString() { final TreeTable table = new DefaultTreeTable(TableColumn.NAME, TableColumn.VALUE); final TreeTable.Node root = table.getRoot(); root.setValue(TableColumn.NAME, Classes.getShortClassName(this)); root.setValue(TableColumn.VALUE, getStorageName()); if (options != null) { final TreeTable.Node op = root.newChild(); op.setValue(TableColumn.NAME, "options"); op.setValue(TableColumn.VALUE, options); } final Coupled c = getView(null); if (c != null) { c.append(root.newChild(), views); } return table.toString(); } }
/** * Returns a string representation of this {@code StorageConnector} for debugging purpose. * This string representation is for debugging purpose only and may change in any future version. * * @return a string representation of this {@code StorageConnector} for debugging purpose. */ @Debug @Override public String toString() { final TreeTable table = new DefaultTreeTable(TableColumn.NAME, TableColumn.VALUE); final TreeTable.Node root = table.getRoot(); root.setValue(TableColumn.NAME, Classes.getShortClassName(this)); root.setValue(TableColumn.VALUE, getStorageName()); if (options != null) { final TreeTable.Node op = root.newChild(); op.setValue(TableColumn.NAME, "options"); op.setValue(TableColumn.VALUE, options); } final Coupled c = getView(null); if (c != null) { c.append(root.newChild(), views); } return table.toString(); } }