<img src="legend.png" />\r
\r
\r
- <h2>Usage example</h2>\r
+ <h2>Usage example 1</h2>\r
\r
- Following example produces graph for JavaInspect itself:\r
+<pre>\r
+<code>\r
+ /*\r
+ * This example demonstrates generating of class graph from hand picked\r
+ * classes.\r
+ */\r
\r
- <pre>\r
+ // Create graph\r
+ final ClassGraph graph = new ClassGraph();\r
\r
-<code>\r
-// Create graph\r
-final ClassGraph graph = new ClassGraph();\r
+ // While classes and objects can be immediately passed to ClassGraph\r
+ // constructor as arguments, it is also possible to add then one by one\r
+ // as in the following example.\r
\r
-// Add some object to the graph.\r
-graph.addObject(graph);\r
+ // Add some object to the graph.\r
+ graph.addObject(graph);\r
\r
-// Add some class to the graph.\r
-graph.addClass(Utils.class);\r
+ // Add some class to the graph.\r
+ graph.addClass(Utils.class);\r
\r
-// Produce bitmap image titled "JavaInspect.png" to the user Desktop\r
-// directory.\r
-graph.generateGraph("JavaInspect", true);\r
+ // Produce bitmap image titled "JavaInspect.png" to the user Desktop\r
+ // directory and keep intermediary GraphViz DOT file for reference.\r
+ graph.generateGraph("JavaInspect", true);\r
</code>\r
\r
\r
</pre>\r
\r
\r
+ <h2>Usage example 2</h2>\r
+\r
+<pre>\r
+<code>\r
+ // Recursively scan current directory for Java source code and attempt\r
+ // to detect class names from there to be added to the graph.\r
+ graph.addProject(".");\r
+\r
+ // Blacklist example classes from being shown on the graph\r
+ graph.getFilter().blacklistClassPattern(\r
+ "eu.svjatoslav.inspector.java.structure.example.*");\r
+\r
+ // do not show single classes with no relationships on the graph\r
+ graph.hideOrphanedClasses();\r
+\r
+ // Produce bitmap image titled "JavaInspect full project.png" to the\r
+ // user Desktop directory.\r
+ graph.generateGraph("JavaInspect full project");\r
+</code>\r
+\r
+\r
+Result:\r
+ Generated PNG image: <a href="JavaInspect full project.png">JavaInspect full project.png</a>\r
+\r
+</pre>\r
+\r
+\r
\r
<h2>Embedding JavaInspect in your project</h2>\r
<pre>\r
<dependency>\r
<groupId>eu.svjatoslav</groupId>\r
<artifactId>javainspect</artifactId>\r
- <version>1.1</version>\r
+ <version>1.2</version>\r
</dependency>\r
\r
</dependencies>\r