From: Svjatoslav Agejenko Date: Fri, 5 Jul 2013 19:44:16 +0000 (+0300) Subject: started java syntax parser X-Git-Tag: javainspect-1.1~15 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=c1600072fe35ecb1651f90fca2f8a5245ab87008;p=javainspect.git started java syntax parser --- diff --git a/pom.xml b/pom.xml index b430009..09c54f8 100755 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ eu.svjatoslav svjatoslavcommons - 1.0 + 1.1-SNAPSHOT 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 index 0000000..65cf3bb --- /dev/null +++ b/src/main/java/eu/svjatoslav/inspector/java/methods/JavaFile.java @@ -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 index 0000000..5387cf4 --- /dev/null +++ b/src/main/java/eu/svjatoslav/inspector/java/methods/Project.java @@ -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 + } + } + +}