improved project documentation
[javainspect.git] / doc / index.html
index 096c1e0..b826e7a 100644 (file)
@@ -70,25 +70,31 @@ This software is distributed under <a
        <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
@@ -99,6 +105,33 @@ Result:
 </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
@@ -112,7 +145,7 @@ Declare JavaInspect as dependency:
         &lt;dependency&gt;\r
             &lt;groupId&gt;eu.svjatoslav&lt;/groupId&gt;\r
             &lt;artifactId&gt;javainspect&lt;/artifactId&gt;\r
-            &lt;version&gt;1.1&lt;/version&gt;\r
+            &lt;version&gt;1.2&lt;/version&gt;\r
         &lt;/dependency&gt;\r
  \r
     &lt;/dependencies&gt;\r