2 * JavaInspect - Utility to visualize java software
3 * Copyright (C) 2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
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.
10 package eu.svjatoslav.inspector.java.structure.example;
12 import java.io.FileNotFoundException;
14 import eu.svjatoslav.inspector.java.structure.ClassGraph;
15 import eu.svjatoslav.inspector.java.structure.Utils;
17 public class RenderJavaInspect {
19 public static void main(final String[] args) throws FileNotFoundException {
21 handpickClassesExample();
27 private static void fullProjectExample() {
28 final ClassGraph graph = new ClassGraph();
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(".");
34 // Blacklist example classes from being shown on the graph
35 graph.getFilter().blacklistClassPattern(
36 "eu.svjatoslav.inspector.java.structure.example.*");
38 // do not show single classes with no relationships on the graph
39 graph.hideOrphanedClasses();
41 // Produce bitmap image titled "JavaInspect full project.png" to the
42 // user Desktop directory.
43 graph.generateGraph("JavaInspect full project");
46 private static void handpickClassesExample() {
48 * This example demonstrates generating of class graph from hand picked
53 final ClassGraph graph = new ClassGraph();
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.
59 // Add some object to the graph.
60 graph.addObject(graph);
62 // Add some class to the graph.
63 graph.addClass(Utils.class);
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);