Class GraphvizGrapher
- java.lang.Object
-
- com.google.inject.grapher.AbstractInjectorGrapher
-
- 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 inGraphvizModule
.Specify the
PrintWriter
to output to withsetOut(PrintWriter)
.- Since:
- 4.0
- Author:
- phopkins@gmail.com (Pete Hopkins)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.inject.grapher.AbstractInjectorGrapher
AbstractInjectorGrapher.GrapherParameters
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finish()
protected String
getArrowString(List<ArrowType> arrows)
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 String
htmlEscape(String str)
protected List<String>
htmlEscape(List<String> elements)
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
-
-
-
-
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 classAbstractInjectorGrapher
-
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 classAbstractInjectorGrapher
-
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 ofImplementationNode
s) rows for each of the member fields.
-
renderEdge
protected void renderEdge(GraphvizEdge edge)
-
getEdgeAttributes
protected Map<String,String> getEdgeAttributes(GraphvizEdge edge)
-
getEdgeEndPoint
protected String getEdgeEndPoint(String nodeId, String portId, CompassPoint compassPoint)
-
newInterfaceNode
protected void newInterfaceNode(InterfaceNode node)
Description copied from class:AbstractInjectorGrapher
Adds a new interface node to the graph.- Specified by:
newInterfaceNode
in classAbstractInjectorGrapher
-
newImplementationNode
protected void newImplementationNode(ImplementationNode node)
Description copied from class:AbstractInjectorGrapher
Adds a new implementation node to the graph.- Specified by:
newImplementationNode
in classAbstractInjectorGrapher
-
newInstanceNode
protected void newInstanceNode(InstanceNode node)
Description copied from class:AbstractInjectorGrapher
Adds a new instance node to the graph.- Specified by:
newInstanceNode
in classAbstractInjectorGrapher
-
newDependencyEdge
protected void newDependencyEdge(DependencyEdge edge)
Description copied from class:AbstractInjectorGrapher
Adds a new dependency edge to the graph.- Specified by:
newDependencyEdge
in classAbstractInjectorGrapher
-
newBindingEdge
protected void newBindingEdge(BindingEdge edge)
Description copied from class:AbstractInjectorGrapher
Adds a new binding edge to the graph.- Specified by:
newBindingEdge
in classAbstractInjectorGrapher
-
-