2 * JavaInspect - Utility to visualize java software
3 * Copyright (C) 2013-2015, 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 3 of the GNU Lesser General Public License
7 * or later as published by the Free Software Foundation.
10 package eu.svjatoslav.inspector.java.structure.example;
12 import eu.svjatoslav.inspector.java.structure.ClassGraph;
13 import eu.svjatoslav.inspector.java.structure.Utils;
15 import java.io.FileNotFoundException;
17 public class RenderJavaInspect {
19 private static void fullProjectExample() {
21 final ClassGraph graph = new ClassGraph();
23 // Recursively scan current directory for Java source code and attempt
24 // to detect class names from there to be added to the graph.
25 graph.addProject(".");
27 // Blacklist example classes from being shown on the graph
28 graph.blacklistClassPattern("eu.svjatoslav.inspector.java.structure.example.*");
30 // do not show single classes with no relationships on the graph
31 graph.hideOrphanedClasses();
33 // Produce bitmap image titled "JavaInspect full project.png" to the
34 // user Desktop directory.
35 graph.generateGraph("JavaInspect full project");
38 private static void handpickClassesExample() {
40 * This example demonstrates generating of class graph from hand picked
41 * classes and visualizing GraphViz itself.
45 final ClassGraph graph = new ClassGraph();
47 // Add some random object to the graph. GraphViz will detect Class from
51 // Also add some random class to the graph.
52 graph.add(Utils.class);
54 // Keep intermediary GraphViz DOT file for reference.
55 graph.setKeepDotFile(true);
57 // Produce bitmap image titled "JavaInspect.png" to the user Desktop
59 graph.generateGraph("JavaInspect");
62 public static void main(final String[] args) throws FileNotFoundException {
64 handpickClassesExample();