Revision: 1576
Author: boj...@google.com
Date: Mon Aug 1 17:13:34 2011
Log: Edited wiki page Grapher through web user interface.
http://code.google.com/p/google-guice/source/detail?r=1576
Modified:
/wiki/Grapher.wiki
=======================================
--- /wiki/Grapher.wiki Mon Jul 18 21:12:56 2011
+++ /wiki/Grapher.wiki Mon Aug 1 17:13:34 2011
@@ -4,6 +4,31 @@
==Generating a .dot file==
Guice's grapher leans heavily on [http://www.graphviz.org/ GraphViz], an
open source graph visualization package. It cleanly separates graph
specification from visualization and layout. To produce a graph `.dot` file
for an `Injector`, you can use the following code:
+
+===For Guice 3.0 or earlier===
+{{{
+import com.google.inject.Injector;
+import com.google.inject.grapher.GrapherModule;
+import com.google.inject.grapher.InjectorGrapher;
+import com.google.inject.grapher.graphviz.GraphvizModule;
+import com.google.inject.grapher.graphviz.GraphvizRenderer;
+
+public class Grapher {
+ private void graph(String filename, Injector demoInjector) throws
IOException {
+ PrintWriter out = new PrintWriter(new File(filename), "UTF-8");
+
+ Injector injector = Guice.createInjector(new GrapherModule(), new
GraphvizModule());
+ GraphvizRenderer renderer =
injector.getInstance(GraphvizRenderer.class);
+ renderer.setOut(out).setRankdir("TB");
+
+ injector.getInstance(InjectorGrapher.class)
+ .of(demoInjector)
+ .graph();
+ }
+}
+}}}
+
+===For future releases===
{{{
import com.google.inject.Injector;
import com.google.inject.grapher.graphviz.GraphvizGrapher;
--
You received this message because you are subscribed to the Google Groups
"google-guice-dev" group.
To post to this group, send email to google-guice-dev@googlegroups.com.
To unsubscribe from this group, send email to
google-guice-dev+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-guice-dev?hl=en.