From c1600072fe35ecb1651f90fca2f8a5245ab87008 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Fri, 5 Jul 2013 22:44:16 +0300 Subject: [PATCH] started java syntax parser --- pom.xml | 2 +- .../inspector/java/methods/JavaFile.java | 17 +++++++ .../inspector/java/methods/Project.java | 51 +++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 src/main/java/eu/svjatoslav/inspector/java/methods/JavaFile.java create mode 100644 src/main/java/eu/svjatoslav/inspector/java/methods/Project.java 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 + } + } + +} -- 2.20.1