Proof of concept: it is really possible to render classes
[javainspect.git] / src / main / java / eu / svjatoslav / inspector / java / Main.java
1 package eu.svjatoslav.inspector.java;
2
3 import eu.svjatoslav.inspector.java.structure.ClassGraph;
4
5 import java.io.File;
6 import java.net.MalformedURLException;
7 import java.net.URL;
8 import java.net.URLClassLoader;
9
10 import static java.io.File.separator;
11 import static java.lang.System.getProperty;
12
13 /**
14  * This class acts as a commandline interface for JavaInspect.
15  */
16 public class Main {
17         public static void main(String[] args) throws MalformedURLException, ClassNotFoundException {
18         CommandlineConfiguration commandlineConfiguration = new CommandlineConfiguration(args);
19         System.out.println("Commandline config validated");
20
21         File jarFile = commandlineConfiguration.jarFile.getValue();
22
23         URLClassLoader classLoader = new URLClassLoader(
24                 new URL[]{jarFile.toURL()},
25                 commandlineConfiguration.getClass().getClassLoader());
26
27         Class classToLoad = Class.forName("eu.svjatoslav.sixth.e3d.gui.GuiComponent", true, classLoader);
28
29
30                 ClassGraph cg = new ClassGraph();
31                 cg.setTargetDirectoryPath(getProperty("user.dir") + separator);
32
33 //              cg.addProject(projectDir);
34 //              cg.whitelistClassGlob(packageGlob);
35                 cg.setKeepDotFile(true);
36                 cg.add(classToLoad);
37                 cg.generateGraph(commandlineConfiguration.graphName.getValue());
38         }
39 }