package com.tinkerpop.blueprints.util;

import com.tinkerpop.blueprints.AnnotatedList;
import com.tinkerpop.blueprints.AnnotatedValue;
import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Graph;
import com.tinkerpop.blueprints.Property;
import com.tinkerpop.blueprints.Vertex;


/**
 * A collection of helpful methods for creating standard {@link Object#toString()} representations of graph-related
 * objects.
 *
 * @author Marko A. Rodriguez (http://markorodriguez.com)
 */
public class StringFactory {

    private static final String V = "v";
    private static final String E = "e";
    private static final String P = "p";
    private static final String L_BRACKET = "[";
    private static final String R_BRACKET = "]";
    private static final String COMMA_SPACE = ", ";
    private static final String COLON = ":";
    private static final String EMPTY_MAP = "{}";
    private static final String DOTS = "...";
    private static final String DASH = "-";
    private static final String ARROW = "->";
    private static final String EMPTY_PROPERTY = "p[empty]";
    private static final String VALUE = "value";

    public static String vertexString(final Vertex vertex) {
        return V + L_BRACKET + vertex.getId() + R_BRACKET;
    }

    public static String edgeString(final Edge edge) {
        return E + L_BRACKET + edge.getId() + R_BRACKET + L_BRACKET + edge.getVertex(Direction.OUT).getId() + DASH + edge.getLabel() + ARROW + edge.getVertex(Direction.IN).getId() + R_BRACKET;
    }

    public static String propertyString(final Property property) {
        return property.isPresent() ? P + L_BRACKET + property.getKey() + ARROW + property.get() + R_BRACKET : EMPTY_PROPERTY;
    }

    public static String graphString(final Graph graph, final String internalString) {
        return graph.getClass().getSimpleName().toLowerCase() + L_BRACKET + internalString + R_BRACKET;
    }

    public static String annotatedListString(final AnnotatedList annotatedList) {
        final StringBuilder builder = new StringBuilder(L_BRACKET);
        annotatedList.query().limit(2).values().forEach(v -> builder.append(v).append(COMMA_SPACE));
        if (builder.length() > 1)
            builder.append(DOTS);
        builder.append(R_BRACKET);
        return builder.toString();
    }

    public static String annotatedValueString(final AnnotatedValue annotatedValue) {
        return L_BRACKET + annotatedValue.getValue() + COLON + EMPTY_MAP + R_BRACKET;
    }
}

@@ -1128,57 +1128,82 @@
 %5D%22;%0A
+%0A
     
-private static final String VALUE = %22value%22;%0A
+/**%0A     * Construct the representation for a %7B@link Vertex%7D.%0A     */
 %0A   
@@ -1318,32 +1318,104 @@
 BRACKET;%0A    %7D%0A%0A
+    /**%0A     * Construct the representation for a %7B@link Edge%7D.%0A     */%0A
     public stati
@@ -1645,32 +1645,108 @@
 BRACKET;%0A    %7D%0A%0A
+    /**%0A     * Construct the representation for a %7B@link Property%7D.%0A     */%0A
     public stati
@@ -1922,32 +1922,220 @@
 ROPERTY;%0A    %7D%0A%0A
+    /**%0A     * Construct the representation for a %7B@link Graph%7D.%0A     *%0A     * @param internalString a custom %7B@link String%7D that appends to the end of the standard representation%0A     */%0A
     public stati
@@ -2308,32 +2308,113 @@
 BRACKET;%0A    %7D%0A%0A
+    /**%0A     * Construct the representation for a %7B@link AnnotatedList%7D.%0A     */%0A
     public stati
@@ -2789,24 +2789,106 @@
 g();%0A    %7D%0A%0A
+    /**%0A     * Construct the representation for a %7B@link AnnotatedValue%7D.%0A     */%0A
     public s

Add javadoc.