started java syntax parser
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 5 Jul 2013 19:44:16 +0000 (22:44 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Fri, 5 Jul 2013 19:44:16 +0000 (22:44 +0300)
pom.xml
src/main/java/eu/svjatoslav/inspector/java/methods/JavaFile.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/inspector/java/methods/Project.java [new file with mode: 0644]

diff --git a/pom.xml b/pom.xml
index b430009..09c54f8 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
                <dependency>
                        <groupId>eu.svjatoslav</groupId>
                        <artifactId>svjatoslavcommons</artifactId>
-                       <version>1.0</version>
+                       <version>1.1-SNAPSHOT</version>
                </dependency>
        </dependencies>
 
diff --git a/src/main/java/eu/svjatoslav/inspector/java/methods/JavaFile.java b/src/main/java/eu/svjatoslav/inspector/java/methods/JavaFile.java
new file mode 100644 (file)
index 0000000..65cf3bb
--- /dev/null
@@ -0,0 +1,17 @@
+package eu.svjatoslav.inspector.java.methods;
+
+import java.io.File;
+
+public class JavaFile {
+
+       private final File file;
+
+       public JavaFile(final File file) {
+               this.file = file;
+       }
+
+       public void parse() {
+
+       }
+
+}
diff --git a/src/main/java/eu/svjatoslav/inspector/java/methods/Project.java b/src/main/java/eu/svjatoslav/inspector/java/methods/Project.java
new file mode 100644 (file)
index 0000000..5387cf4
--- /dev/null
@@ -0,0 +1,51 @@
+package eu.svjatoslav.inspector.java.methods;
+
+import java.io.File;
+
+import eu.svjatoslav.commons.file.FilePathParser;
+
+public class Project {
+
+       private final File projectPath;
+
+       public Project(final File projectPath) {
+               this.projectPath = projectPath;
+               parse();
+       }
+
+       public void parse() {
+
+               if (!projectPath.exists())
+                       System.out.println("Project not found on path: " + projectPath);
+
+               if (!projectPath.canRead())
+                       System.out.println("Cannot read project path: " + projectPath);
+
+               if (projectPath.isDirectory())
+                       parseDirectory(projectPath);
+
+               if (projectPath.isFile())
+                       parseFile(projectPath);
+       }
+
+       public void parseDirectory(final File file) {
+
+               for (final File subFile : file.listFiles()) {
+
+                       if (subFile.isFile())
+                               parseFile(subFile);
+
+                       if (subFile.isDirectory())
+                               parseDirectory(subFile);
+               }
+       }
+
+       public void parseFile(final File file) {
+               final String fileExtension = FilePathParser.getFileExtension(file);
+               if ("java".equalsIgnoreCase(fileExtension)){
+                       JavaFile javaFile = new JavaFile(file);
+                       // oeu
+               }
+       }
+
+}