All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.schema.diffing.GraphPrinter Maven / Gradle / Ivy

There is a newer version: 230521-nf-execution
Show newest version
package graphql.schema.diffing;

import graphql.Internal;
import graphql.schema.diffing.dot.Dotfile;

@Internal
public class GraphPrinter {

    public static String print(SchemaGraph schemaGraph) {
        Dotfile dotfile = new Dotfile();
        for (Vertex vertex : schemaGraph.getVertices()) {
            String name = vertex.get("name");
            if (name == null) {
                name = vertex.getType();
            }
            dotfile.addNode("V" + Integer.toHexString(vertex.hashCode()), name, "blue");
        }
        for (Edge edge : schemaGraph.getEdges()) {
            dotfile.addEdge("V" + Integer.toHexString(edge.getFrom().hashCode()), "V" + Integer.toHexString(edge.getTo().hashCode()), edge.getLabel());
        }
        return dotfile.print();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy