spearately count interface implementations
[javainspect.git] / src / main / java / eu / svjatoslav / inspector / java / structure / example / RenderJavaInspect.java
1 /*
2  * JavaInspect - Utility to visualize java software
3  * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.inspector.java.structure.example;
11
12 import java.io.FileNotFoundException;
13
14 import eu.svjatoslav.inspector.java.structure.ClassGraph;
15 import eu.svjatoslav.inspector.java.structure.Utils;
16
17 public class RenderJavaInspect {
18
19         public static void main(final String[] args) throws FileNotFoundException {
20
21                 handpickClassesExample();
22
23                 fullProjectExample();
24
25         }
26
27         private static void fullProjectExample() {
28                 final ClassGraph graph = new ClassGraph();
29
30                 // Recursively scan current directory for Java source code and attempt
31                 // to detect class names from there to be added to the graph.
32                 graph.addProject(".");
33
34                 // Blacklist example classes from being shown on the graph
35                 graph.getFilter().blacklistClassPattern(
36                                 "eu.svjatoslav.inspector.java.structure.example.*");
37
38                 // do not show single classes with no relationships on the graph
39                 graph.hideOrphanedClasses();
40
41                 // Produce bitmap image titled "JavaInspect full project.png" to the
42                 // user Desktop directory.
43                 graph.generateGraph("JavaInspect full project");
44         }
45
46         private static void handpickClassesExample() {
47                 /*
48                  * This example demonstrates generating of class graph from hand picked
49                  * classes.
50                  */
51
52                 // Create graph
53                 final ClassGraph graph = new ClassGraph();
54
55                 // While classes and objects can be immediately passed to ClassGraph
56                 // constructor as arguments, it is also possible to add then one by one
57                 // as in the following example.
58
59                 // Add some object to the graph.
60                 graph.addObject(graph);
61
62                 // Add some class to the graph.
63                 graph.addClass(Utils.class);
64
65                 // Produce bitmap image titled "JavaInspect.png" to the user Desktop
66                 // directory and keep intermediary GraphViz DOT file for reference.
67                 graph.generateGraph("JavaInspect", true);
68         }
69 }