Reorganized project.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 24 Dec 2017 13:20:17 +0000 (15:20 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sun, 24 Dec 2017 13:20:17 +0000 (15:20 +0200)
+ Moved Demo project from test source directory to dedicated project directory.
+ Added SVG and PNG outputs as configurable options.
+ Migrated to java 8.

33 files changed:
example/pom.xml [deleted file]
example/src/main/java/com/myproject/Behavior.java [deleted file]
example/src/main/java/com/myproject/NumberTranslator.java [deleted file]
javainspect.iml
pom.xml
src/main/java/eu/svjatoslav/inspector/java/Main.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/inspector/java/RenderJavaInspect.java [new file with mode: 0755]
src/main/java/eu/svjatoslav/inspector/java/methods/Main.java [deleted file]
src/main/java/eu/svjatoslav/inspector/java/methods/package-info.java
src/main/java/eu/svjatoslav/inspector/java/structure/ClassGraph.java
src/main/java/eu/svjatoslav/inspector/java/structure/TargetImageType.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/inspector/java/structure/package-info.java [new file with mode: 0755]
src/test/java/eu/svjatoslav/inspector/java/structure/example/RenderDemoClasses.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/RenderJavaInspect.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/ObjectReturnedByMethod.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/ObjectVisibleAsClassField.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleClass.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleClass2.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleEnum.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleInterface.java [deleted file]
src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleSuperClass.java [deleted file]
usage examples/demo project/.gitignore [new file with mode: 0644]
usage examples/demo project/javainspect-demo.iml [new file with mode: 0644]
usage examples/demo project/pom.xml [new file with mode: 0644]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/RenderUsingReflection.java [new file with mode: 0755]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/ObjectReturnedByMethod.java [new file with mode: 0755]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/ObjectVisibleAsClassField.java [new file with mode: 0755]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleClass.java [new file with mode: 0755]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleClass2.java [new file with mode: 0644]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleEnum.java [new file with mode: 0755]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleInterface.java [new file with mode: 0755]
usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleSuperClass.java [new file with mode: 0755]
usage examples/demo project/tools/open with IntelliJ IDEA [new file with mode: 0755]

diff --git a/example/pom.xml b/example/pom.xml
deleted file mode 100644 (file)
index e3d0312..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>com.myproject</groupId>
-    <artifactId>myproject</artifactId>
-    <version>0.0</version>
-    <packaging>jar</packaging>
-    <name>MyProject</name>
-    <description>MyProject</description>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                    <encoding>UTF-8</encoding>
-                </configuration>
-            </plugin>
-               </plugins>
-       </build>
-</project>
diff --git a/example/src/main/java/com/myproject/Behavior.java b/example/src/main/java/com/myproject/Behavior.java
deleted file mode 100644 (file)
index d35ce27..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.myproject;
-
-public interface Behavior {
-
-    String translate(Object obj);
-
-    default String serialize(Object obj) {
-        return obj.toString();
-    }
-}
diff --git a/example/src/main/java/com/myproject/NumberTranslator.java b/example/src/main/java/com/myproject/NumberTranslator.java
deleted file mode 100644 (file)
index b0cb6c4..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.myproject;
-
-public class NumberTranslator implements Behavior {
-
-    public String translate(Object obj) {
-        return serialize(obj);
-    }
-}
index ea566de..a81dd61 100644 (file)
@@ -1,15 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6">
-    <output url="file://$MODULE_DIR$/target/classes" />
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
-      <excludeFolder url="file://$MODULE_DIR$/target" />
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+    <output url="file://$MODULE_DIR$/../../target/classes" />
+    <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
+    <content url="file://$MODULE_DIR$/../..">
+      <sourceFolder url="file://$MODULE_DIR$/../../src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/../../src/test/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/../../doc/example" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/../../target" />
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" name="Maven: eu.svjatoslav:svjatoslavcommons:1.5" level="project" />
+    <orderEntry type="library" name="Maven: eu.svjatoslav:svjatoslavcommons:1.6" level="project" />
   </component>
 </module>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index fbdb534..592064d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -25,8 +25,8 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>2.3.2</version>
                 <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
+                    <source>1.8</source>
+                    <target>1.8</target>
                     <encoding>UTF-8</encoding>
                 </configuration>
             </plugin>
@@ -85,7 +85,7 @@
                         <configuration>
                             <transformers>
                                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                                    <mainClass>eu.svjatoslav.inspector.java.methods.Main</mainClass>
+                                    <mainClass>eu.svjatoslav.inspector.java.Main</mainClass>
                                 </transformer>
                             </transformers>
                         </configuration>
         <dependency>
             <groupId>eu.svjatoslav</groupId>
             <artifactId>svjatoslavcommons</artifactId>
-            <version>1.5</version>
+            <version>1.6</version>
         </dependency>
     </dependencies>
 
diff --git a/src/main/java/eu/svjatoslav/inspector/java/Main.java b/src/main/java/eu/svjatoslav/inspector/java/Main.java
new file mode 100644 (file)
index 0000000..f57f787
--- /dev/null
@@ -0,0 +1,29 @@
+package eu.svjatoslav.inspector.java;
+
+import eu.svjatoslav.inspector.java.structure.ClassGraph;
+
+import static java.io.File.separator;
+import static java.lang.System.getProperty;
+
+public class Main {
+       public static void main(String[] args) {
+               if (args.length == 0) {
+                       System.err.println("usage: javainspect [PROJECT_DIR] [PACKAGE_GLOB] [GRAPH_NAME]");
+                       System.exit(1);
+               }
+
+               String projectDir  = args[0];
+               String packageGlob = args[1];
+               String graphName   = args[2];
+
+               ClassGraph cg = new ClassGraph();
+               cg.setTargetDirectoryPath(getProperty("user.dir") + separator);
+
+               cg.addProject(projectDir);
+               cg.whitelistClassPattern(packageGlob);
+               cg.setKeepDotFile(true);
+               cg.generateGraph(graphName);
+
+               System.exit(0);
+       }
+}
diff --git a/src/main/java/eu/svjatoslav/inspector/java/RenderJavaInspect.java b/src/main/java/eu/svjatoslav/inspector/java/RenderJavaInspect.java
new file mode 100755 (executable)
index 0000000..c33c8a9
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.inspector.java;
+
+import eu.svjatoslav.inspector.java.structure.ClassGraph;
+import eu.svjatoslav.inspector.java.structure.Utils;
+
+import java.io.FileNotFoundException;
+
+public class RenderJavaInspect {
+
+    private static void fullProjectExample() {
+        // Create graph
+        final ClassGraph graph = new ClassGraph();
+
+        // Recursively scan current directory for Java source code and attempt
+        // to detect class names from there to be added to the graph.
+        graph.addProject(".");
+
+        // do not show single classes with no relationships on the graph
+        graph.hideOrphanedClasses();
+
+        // Produce SVG image titled "JavaInspect full project.png" to the
+        // user Desktop directory.
+        graph.generateGraph("JavaInspect full project");
+    }
+
+    private static void handpickClassesExample() {
+        /*
+         * This example demonstrates generating of class graph from hand picked
+                * classes and visualizing GraphViz itself.
+                */
+
+        // Create graph
+        final ClassGraph graph = new ClassGraph();
+
+        // Add some random object to the graph. GraphViz will detect Class from
+        // the object.
+        graph.add(graph);
+
+        // Also add some random class to the graph.
+        graph.add(Utils.class);
+
+        // Keep intermediary GraphViz DOT file for reference.
+        graph.setKeepDotFile(true);
+
+        // Produce SVG image titled "JavaInspect.svg" to the user Desktop
+        // directory
+        graph.generateGraph("JavaInspect");
+    }
+
+    public static void main(final String[] args) throws FileNotFoundException {
+
+        handpickClassesExample();
+
+        fullProjectExample();
+
+    }
+}
diff --git a/src/main/java/eu/svjatoslav/inspector/java/methods/Main.java b/src/main/java/eu/svjatoslav/inspector/java/methods/Main.java
deleted file mode 100644 (file)
index 7450c99..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package eu.svjatoslav.inspector.java.methods;
-
-import eu.svjatoslav.inspector.java.structure.ClassGraph;
-
-import java.io.File;
-
-import static java.lang.System.getProperty;
-
-public class Main {
-       public static void main(String[] args) {
-               if (args.length == 0) {
-                       System.err.println("usage: javainspect [PROJECT_DIR] [PACKAGE_GLOB] [GRAPH_NAME]");
-                       System.exit(1);
-               }
-
-               String projectDir  = args[0];
-               String packageGlob = args[1];
-               String graphName   = args[2];
-
-               ClassGraph cg = new ClassGraph();
-               cg.setTargetDirectory(getProperty("user.dir") + File.separator);
-
-               cg.addProject(projectDir);
-               cg.whitelistClassPattern(packageGlob);
-               cg.setKeepDotFile(true);
-               cg.generateGraph(graphName);
-
-               System.exit(0);
-       }
-}
index 3897205..b18889c 100755 (executable)
@@ -12,7 +12,8 @@ package eu.svjatoslav.inspector.java.methods;
 /**
  * This package contains quickly hacked together Java language parser.
  * Goal is to start visualizing method call references and other things
- * which are not easily readable at runtime via reflection.
+ * which are not easily readable at runtime via reflection but are available
+ * when parsing java source code directly.
  * <p>
  * Work in progress...
  * <p>
index c6b6cbf..a4d9015 100755 (executable)
@@ -23,6 +23,7 @@ import java.util.List;
 import java.util.Map;
 
 import static eu.svjatoslav.inspector.java.methods.JavaFile.UTF_8;
+import static java.io.File.separator;
 
 public class ClassGraph {
 
@@ -35,11 +36,13 @@ public class ClassGraph {
 
     private final List<String> whitelistClassPatterns = new ArrayList<String>();
 
-    private String targetDirectory = CommonPathResolver.getDesktopDirectory()
-            .getAbsolutePath() + "/";
+    private String targetDirectoryPath = CommonPathResolver.getDesktopDirectory()
+            .getAbsolutePath() + separator;
 
     private boolean keepDotFile;
 
+    TargetImageType targetImageType = TargetImageType.SVG;
+
     public ClassGraph() {
     }
 
@@ -84,6 +87,10 @@ public class ClassGraph {
         blacklistClassPatterns.add(pattern);
     }
 
+    public void setTargetImageType(TargetImageType targetImageType) {
+        this.targetImageType = targetImageType;
+    }
+
     /**
      * @param resultFileName file name for the generated graph. File extension will be
      *                       added automatically. Existing file with the same name will be
@@ -92,10 +99,8 @@ public class ClassGraph {
 
     public void generateGraph(final String resultFileName) {
 
-        final String dotFilePath = targetDirectory + resultFileName + ".dot";
-        final String imageFilePath = targetDirectory + resultFileName + ".svg";
-
-        System.out.println("Dot file path:" + dotFilePath);
+        final String dotFilePath = targetDirectoryPath + resultFileName + ".dot";
+        final String imageFilePath = targetDirectoryPath + resultFileName + "." + targetImageType.fileExtension;
 
         try {
             // write DOT file to disk
@@ -106,16 +111,18 @@ public class ClassGraph {
             // execute GraphViz to visualize graph
             try {
                 Runtime.getRuntime()
-                        .exec(new String[]{"dot", "-Tsvg", dotFilePath, "-o",
+                        .exec(new String[]{"dot", "-T" + targetImageType.fileExtension, dotFilePath, "-o",
                                 imageFilePath}).waitFor();
             } catch (final InterruptedException ignored) {
             }
 
             if (!keepDotFile)
                 // delete dot file
-                if (!new File(dotFilePath).delete()) throw new RuntimeException("Cannot delete file: " + dotFilePath);
+                if (!new File(dotFilePath).delete())
+                    throw new RuntimeException("Cannot delete file: " + dotFilePath);
+
         } catch (final IOException e) {
-            System.err.println(e);
+            throw new RuntimeException("Unable to generate graph: " + e.getMessage(), e);
         }
 
     }
@@ -196,11 +203,11 @@ public class ClassGraph {
         return this;
     }
 
-    public ClassGraph setTargetDirectory(String directoryPath) {
-        if (!directoryPath.endsWith("/"))
-            directoryPath += "/";
+    public ClassGraph setTargetDirectoryPath(String directoryPath) {
+        if (!directoryPath.endsWith(separator))
+            directoryPath += separator;
 
-        targetDirectory = directoryPath;
+        targetDirectoryPath = directoryPath;
 
         return this;
     }
diff --git a/src/main/java/eu/svjatoslav/inspector/java/structure/TargetImageType.java b/src/main/java/eu/svjatoslav/inspector/java/structure/TargetImageType.java
new file mode 100644 (file)
index 0000000..637724a
--- /dev/null
@@ -0,0 +1,12 @@
+package eu.svjatoslav.inspector.java.structure;
+
+public enum TargetImageType {
+    PNG("png"),
+    SVG("svg");
+
+    public final String fileExtension;
+
+    TargetImageType(String fileExtension){
+        this.fileExtension = fileExtension;
+    }
+}
diff --git a/src/main/java/eu/svjatoslav/inspector/java/structure/package-info.java b/src/main/java/eu/svjatoslav/inspector/java/structure/package-info.java
new file mode 100755 (executable)
index 0000000..eee827e
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.inspector.java.structure;
+
+/**
+ * This package contains mostly code that inspects java application by traversing
+ * class references using reflection at runtime.
+ */
+
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/RenderDemoClasses.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/RenderDemoClasses.java
deleted file mode 100755 (executable)
index 90aa480..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * JavaInspect - Utility to visualize java software
- * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.inspector.java.structure.example;
-
-import eu.svjatoslav.inspector.java.structure.ClassGraph;
-import eu.svjatoslav.inspector.java.structure.example.structure.SampleClass;
-import eu.svjatoslav.inspector.java.structure.example.structure.SampleClass2;
-
-public class RenderDemoClasses {
-
-    public static void main(final String[] args) {
-
-        new ClassGraph().add(SampleClass.class, SampleClass2.class)
-                .generateGraph("example");
-    }
-
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/RenderJavaInspect.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/RenderJavaInspect.java
deleted file mode 100755 (executable)
index 1f38883..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * JavaInspect - Utility to visualize java software
- * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- */
-
-package eu.svjatoslav.inspector.java.structure.example;
-
-import eu.svjatoslav.inspector.java.structure.ClassGraph;
-import eu.svjatoslav.inspector.java.structure.Utils;
-
-import java.io.FileNotFoundException;
-
-public class RenderJavaInspect {
-
-    private static void fullProjectExample() {
-        // Create graph
-        final ClassGraph graph = new ClassGraph();
-
-        // Recursively scan current directory for Java source code and attempt
-        // to detect class names from there to be added to the graph.
-        graph.addProject(".");
-
-        // Blacklist example classes from being shown on the graph
-        graph.blacklistClassPattern("eu.svjatoslav.inspector.java.structure.example.*");
-
-        // do not show single classes with no relationships on the graph
-        graph.hideOrphanedClasses();
-
-        // Produce bitmap image titled "JavaInspect full project.png" to the
-        // user Desktop directory.
-        graph.generateGraph("JavaInspect full project");
-    }
-
-    private static void handpickClassesExample() {
-        /*
-         * This example demonstrates generating of class graph from hand picked
-                * classes and visualizing GraphViz itself.
-                */
-
-        // Create graph
-        final ClassGraph graph = new ClassGraph();
-
-        // Add some random object to the graph. GraphViz will detect Class from
-        // the object.
-        graph.add(graph);
-
-        // Also add some random class to the graph.
-        graph.add(Utils.class);
-
-        // Keep intermediary GraphViz DOT file for reference.
-        graph.setKeepDotFile(true);
-
-        // Produce bitmap image titled "JavaInspect.png" to the user Desktop
-        // directory
-        graph.generateGraph("JavaInspect");
-    }
-
-    public static void main(final String[] args) throws FileNotFoundException {
-
-        handpickClassesExample();
-
-        fullProjectExample();
-
-    }
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/ObjectReturnedByMethod.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/ObjectReturnedByMethod.java
deleted file mode 100755 (executable)
index 3e507bb..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package eu.svjatoslav.inspector.java.structure.example.structure;
-
-public class ObjectReturnedByMethod {
-
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/ObjectVisibleAsClassField.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/ObjectVisibleAsClassField.java
deleted file mode 100755 (executable)
index c69a881..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package eu.svjatoslav.inspector.java.structure.example.structure;
-
-public class ObjectVisibleAsClassField {
-
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleClass.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleClass.java
deleted file mode 100755 (executable)
index 9336717..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-package eu.svjatoslav.inspector.java.structure.example.structure;
-
-public class SampleClass extends SampleSuperClass {
-
-    ObjectVisibleAsClassField sampleClassField;
-
-    public ObjectReturnedByMethod sampleMethod() {
-        return new ObjectReturnedByMethod();
-    }
-
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleClass2.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleClass2.java
deleted file mode 100644 (file)
index 83b5205..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package eu.svjatoslav.inspector.java.structure.example.structure;
-
-public class SampleClass2 extends SampleSuperClass {
-
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleEnum.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleEnum.java
deleted file mode 100755 (executable)
index 05a3f80..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package eu.svjatoslav.inspector.java.structure.example.structure;
-
-public enum SampleEnum {
-
-    ONE, TWO, THREE, FOUR
-
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleInterface.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleInterface.java
deleted file mode 100755 (executable)
index e9d6bc5..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package eu.svjatoslav.inspector.java.structure.example.structure;
-
-public interface SampleInterface {
-    SampleEnum getSomeValue();
-}
diff --git a/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleSuperClass.java b/src/test/java/eu/svjatoslav/inspector/java/structure/example/structure/SampleSuperClass.java
deleted file mode 100755 (executable)
index 10de17e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-package eu.svjatoslav.inspector.java.structure.example.structure;
-
-public class SampleSuperClass implements SampleInterface {
-
-    @Override
-    public SampleEnum getSomeValue() {
-        return SampleEnum.ONE;
-    }
-
-}
diff --git a/usage examples/demo project/.gitignore b/usage examples/demo project/.gitignore
new file mode 100644 (file)
index 0000000..2d513a0
--- /dev/null
@@ -0,0 +1,2 @@
+/.idea/
+/target/
diff --git a/usage examples/demo project/javainspect-demo.iml b/usage examples/demo project/javainspect-demo.iml
new file mode 100644 (file)
index 0000000..42e85c2
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Maven: eu.svjatoslav:javainspect:1.7-SNAPSHOT" level="project" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/usage examples/demo project/pom.xml b/usage examples/demo project/pom.xml
new file mode 100644 (file)
index 0000000..faee7f6
--- /dev/null
@@ -0,0 +1,40 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>eu.svjatoslav</groupId>
+    <artifactId>javainspect-demo</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>jar</packaging>
+    <name>Java inspect demo</name>
+    <description>Demonstration project for Java inspect utility</description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>2.3.2</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+               </plugins>
+       </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>eu.svjatoslav</groupId>
+            <artifactId>javainspect</artifactId>
+            <version>1.7-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <repositories>
+        <repository>
+            <id>svjatoslav.eu</id>
+            <name>Svjatoslav repository</name>
+            <url>http://www2.svjatoslav.eu/maven/</url>
+        </repository>
+    </repositories>
+</project>
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/RenderUsingReflection.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/RenderUsingReflection.java
new file mode 100755 (executable)
index 0000000..df0ac1b
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013-2015, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 3 of the GNU Lesser General Public License
+ * or later as published by the Free Software Foundation.
+ */
+
+package eu.svjatoslav.inspector.java.structure.example;
+
+import eu.svjatoslav.inspector.java.structure.ClassGraph;
+import eu.svjatoslav.inspector.java.structure.example.torender.SampleClass;
+import eu.svjatoslav.inspector.java.structure.example.torender.SampleClass2;
+
+public class RenderUsingReflection {
+
+    public static void main(final String[] args) {
+
+        new ClassGraph().add(SampleClass.class, SampleClass2.class)
+                .generateGraph("example");
+    }
+
+}
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/ObjectReturnedByMethod.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/ObjectReturnedByMethod.java
new file mode 100755 (executable)
index 0000000..143ab77
--- /dev/null
@@ -0,0 +1,5 @@
+package eu.svjatoslav.inspector.java.structure.example.torender;
+
+public class ObjectReturnedByMethod {
+
+}
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/ObjectVisibleAsClassField.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/ObjectVisibleAsClassField.java
new file mode 100755 (executable)
index 0000000..db5b5cc
--- /dev/null
@@ -0,0 +1,5 @@
+package eu.svjatoslav.inspector.java.structure.example.torender;
+
+public class ObjectVisibleAsClassField {
+
+}
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleClass.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleClass.java
new file mode 100755 (executable)
index 0000000..9720c44
--- /dev/null
@@ -0,0 +1,11 @@
+package eu.svjatoslav.inspector.java.structure.example.torender;
+
+public class SampleClass extends SampleSuperClass {
+
+    ObjectVisibleAsClassField sampleClassField;
+
+    public ObjectReturnedByMethod sampleMethod() {
+        return new ObjectReturnedByMethod();
+    }
+
+}
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleClass2.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleClass2.java
new file mode 100644 (file)
index 0000000..a2eba71
--- /dev/null
@@ -0,0 +1,5 @@
+package eu.svjatoslav.inspector.java.structure.example.torender;
+
+public class SampleClass2 extends SampleSuperClass {
+
+}
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleEnum.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleEnum.java
new file mode 100755 (executable)
index 0000000..ee8bf9e
--- /dev/null
@@ -0,0 +1,7 @@
+package eu.svjatoslav.inspector.java.structure.example.torender;
+
+public enum SampleEnum {
+
+    ONE, TWO, THREE, FOUR
+
+}
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleInterface.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleInterface.java
new file mode 100755 (executable)
index 0000000..648327f
--- /dev/null
@@ -0,0 +1,5 @@
+package eu.svjatoslav.inspector.java.structure.example.torender;
+
+public interface SampleInterface {
+    SampleEnum getSomeValue();
+}
diff --git a/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleSuperClass.java b/usage examples/demo project/src/main/java/eu/svjatoslav/inspector/java/structure/example/torender/SampleSuperClass.java
new file mode 100755 (executable)
index 0000000..9230509
--- /dev/null
@@ -0,0 +1,10 @@
+package eu.svjatoslav.inspector.java.structure.example.torender;
+
+public class SampleSuperClass implements SampleInterface {
+
+    @Override
+    public SampleEnum getSomeValue() {
+        return SampleEnum.ONE;
+    }
+
+}
diff --git a/usage examples/demo project/tools/open with IntelliJ IDEA b/usage examples/demo project/tools/open with IntelliJ IDEA
new file mode 100755 (executable)
index 0000000..1f82875
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+cd "${0%/*}"
+
+cd ..
+idea .