/** * Returns a string representation of the specified hints. This is used by * {@link Hints#toString} in order to share the code provided in this class. */ static String toString(final Map hints) { return format(hints, new IdentityHashMap()); }
/** * Returns a string representation of the specified hints. This is used by * {@link Hints#toString} in order to share the code provided in this class. */ static String toString(final Map<?,?> hints) { return format(hints, new IdentityHashMap<Factory, String>()); }
/** * Returns a string representation of this factory. This method is mostly for debugging purpose, * so the string format may vary across different implementations or versions. The default * implementation formats all {@linkplain #getImplementationHints implementation hints} as a * tree. If the implementation hints include some {@linkplain Factory factory} dependencies, * then the implementation hints for those dependencies will appears under a tree branch. * * @since 2.3 */ public String toString() { final String name = format(this); final Map done = new IdentityHashMap(); // We don't want to rely on Factory.equals(...) done.put(this, name); final String tree = format(getImplementationHints(), done); return name + System.getProperty("line.separator", "\n") + tree; }
/** * Returns a string representation of this factory. This method is mostly for debugging purpose, * so the string format may vary across different implementations or versions. The default * implementation formats all {@linkplain #getImplementationHints implementation hints} as a * tree. If the implementation hints include some {@linkplain Factory factory} dependencies, * then the implementation hints for those dependencies will appears under a tree branch. * * @since 2.3 */ @Override public String toString() { final String name = format(this); final Map<Factory,String> done = new IdentityHashMap<Factory,String>(); // We used IdentityHashMap above because we don't want to rely on Factory.equals(...) done.put(this, name); final String tree = format(getImplementationHints(), done); return name + System.getProperty("line.separator", "\n") + tree; }
/** * Formats the specified hints. This method is just the starting * point for {@link #format(Writer, Map, String, Map)} below. */ private static String format(final Map hints, final Map done) { final Writer table; try { table = new TableWriter(null, " "); format(table, hints, " ", done); } catch (IOException e) { // Should never happen, since we are writing in a buffer. throw new AssertionError(e); } return table.toString(); }
/** * Formats the specified hints. This method is just the starting * point for {@link #format(Writer, Map, String, Map)} below. */ private static String format(final Map<?,?> hints, final Map<Factory,String> done) { final Writer table; try { table = new TableWriter(null, " "); format(table, hints, " ", done); } catch (IOException e) { // Should never happen, since we are writing in a buffer. throw new AssertionError(e); } return table.toString(); }
if (value instanceof Factory) { recursive = (Factory) value; value = format(recursive); final String previous = (String) done.put(recursive, key); if (previous != null) { if (recursive != null) { final String nextIndent = Utilities.spaces(indent.length() + 2); format(table, recursive.getImplementationHints(), nextIndent, done);
if (value instanceof Factory) { recursive = (Factory) value; value = format(recursive); final String previous = done.put(recursive, key); if (previous != null) { if (recursive != null) { final String nextIndent = Utilities.spaces(indent.length() + 2); format(table, recursive.getImplementationHints(), nextIndent, done);