com.google.inject.grapher.graphviz
Class GraphvizGrapher

java.lang.Object
  extended by com.google.inject.grapher.AbstractInjectorGrapher
      extended by com.google.inject.grapher.graphviz.GraphvizGrapher
All Implemented Interfaces:
InjectorGrapher

public class GraphvizGrapher
extends AbstractInjectorGrapher

InjectorGrapher implementation that writes out a Graphviz DOT file of the graph. Dependencies are bound in GraphvizModule.

Specify the PrintWriter to output to with setOut(PrintWriter).

Author:
phopkins@gmail.com (Pete Hopkins)

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.inject.grapher.AbstractInjectorGrapher
AbstractInjectorGrapher.GrapherParameters
 
Method Summary
protected  void finish()
           
protected  String getArrowString(List<ArrowType> arrows)
          Turns a List of ArrowTypes into a String that represents combining them.
protected  Map<String,String> getEdgeAttributes(GraphvizEdge edge)
           
protected  String getEdgeEndPoint(String nodeId, String portId, CompassPoint compassPoint)
           
protected  Map<String,String> getGraphAttributes()
           
protected  Map<String,String> getNodeAttributes(GraphvizNode node)
           
protected  String getNodeLabel(GraphvizNode node)
          Creates the "label" for a node.
protected  List<String> htmlEscape(List<String> elements)
           
protected  String htmlEscape(String str)
           
protected  void newBindingEdge(BindingEdge edge)
          Adds a new binding edge to the graph.
protected  void newDependencyEdge(DependencyEdge edge)
          Adds a new dependency edge to the graph.
protected  void newImplementationNode(ImplementationNode node)
          Adds a new implementation node to the graph.
protected  void newInstanceNode(InstanceNode node)
          Adds a new instance node to the graph.
protected  void newInterfaceNode(InterfaceNode node)
          Adds a new interface node to the graph.
protected  void postProcess()
          Performs any post processing required after all nodes and edges have been added.
protected  void renderEdge(GraphvizEdge edge)
           
protected  void renderNode(GraphvizNode node)
           
protected  void reset()
          Resets the state of the grapher before rendering a new graph.
 void setOut(PrintWriter out)
           
 void setRankdir(String rankdir)
           
protected  void start()
           
 
Methods inherited from class com.google.inject.grapher.AbstractInjectorGrapher
graph, graph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reset

protected void reset()
Description copied from class: AbstractInjectorGrapher
Resets the state of the grapher before rendering a new graph.

Specified by:
reset in class AbstractInjectorGrapher

setOut

public void setOut(PrintWriter out)

setRankdir

public void setRankdir(String rankdir)

postProcess

protected void postProcess()
Description copied from class: AbstractInjectorGrapher
Performs any post processing required after all nodes and edges have been added.

Specified by:
postProcess in class AbstractInjectorGrapher

getGraphAttributes

protected Map<String,String> getGraphAttributes()

start

protected void start()

finish

protected void finish()

renderNode

protected void renderNode(GraphvizNode node)

getNodeAttributes

protected Map<String,String> getNodeAttributes(GraphvizNode node)

getNodeLabel

protected String getNodeLabel(GraphvizNode node)
Creates the "label" for a node. This is a string of HTML that defines a table with a heading at the top and (in the case of ImplementationNodes) rows for each of the member fields.


renderEdge

protected void renderEdge(GraphvizEdge edge)

getEdgeAttributes

protected Map<String,String> getEdgeAttributes(GraphvizEdge edge)

getArrowString

protected String getArrowString(List<ArrowType> arrows)
Turns a List of ArrowTypes into a String that represents combining them. With Graphviz, that just means concatenating them.


getEdgeEndPoint

protected String getEdgeEndPoint(String nodeId,
                                 String portId,
                                 CompassPoint compassPoint)

htmlEscape

protected String htmlEscape(String str)

htmlEscape

protected List<String> htmlEscape(List<String> elements)

newInterfaceNode

protected void newInterfaceNode(InterfaceNode node)
Description copied from class: AbstractInjectorGrapher
Adds a new interface node to the graph.

Specified by:
newInterfaceNode in class AbstractInjectorGrapher

newImplementationNode

protected void newImplementationNode(ImplementationNode node)
Description copied from class: AbstractInjectorGrapher
Adds a new implementation node to the graph.

Specified by:
newImplementationNode in class AbstractInjectorGrapher

newInstanceNode

protected void newInstanceNode(InstanceNode node)
Description copied from class: AbstractInjectorGrapher
Adds a new instance node to the graph.

Specified by:
newInstanceNode in class AbstractInjectorGrapher

newDependencyEdge

protected void newDependencyEdge(DependencyEdge edge)
Description copied from class: AbstractInjectorGrapher
Adds a new dependency edge to the graph.

Specified by:
newDependencyEdge in class AbstractInjectorGrapher

newBindingEdge

protected void newBindingEdge(BindingEdge edge)
Description copied from class: AbstractInjectorGrapher
Adds a new binding edge to the graph.

Specified by:
newBindingEdge in class AbstractInjectorGrapher


Copyright © 2006-2014 Google, Inc.. All Rights Reserved.