5387cf410f4bd43395dcc86464b0981a54d1ec73
[javainspect.git] / src / main / java / eu / svjatoslav / inspector / java / methods / Project.java
1 package eu.svjatoslav.inspector.java.methods;
2
3 import java.io.File;
4
5 import eu.svjatoslav.commons.file.FilePathParser;
6
7 public class Project {
8
9         private final File projectPath;
10
11         public Project(final File projectPath) {
12                 this.projectPath = projectPath;
13                 parse();
14         }
15
16         public void parse() {
17
18                 if (!projectPath.exists())
19                         System.out.println("Project not found on path: " + projectPath);
20
21                 if (!projectPath.canRead())
22                         System.out.println("Cannot read project path: " + projectPath);
23
24                 if (projectPath.isDirectory())
25                         parseDirectory(projectPath);
26
27                 if (projectPath.isFile())
28                         parseFile(projectPath);
29         }
30
31         public void parseDirectory(final File file) {
32
33                 for (final File subFile : file.listFiles()) {
34
35                         if (subFile.isFile())
36                                 parseFile(subFile);
37
38                         if (subFile.isDirectory())
39                                 parseDirectory(subFile);
40                 }
41         }
42
43         public void parseFile(final File file) {
44                 final String fileExtension = FilePathParser.getFileExtension(file);
45                 if ("java".equalsIgnoreCase(fileExtension)){
46                         JavaFile javaFile = new JavaFile(file);
47                         // oeu
48                 }
49         }
50
51 }