Changed license to LGPLv3.
[javainspect.git] / src / main / java / eu / svjatoslav / inspector / java / methods / JavaFile.java
old mode 100644 (file)
new mode 100755 (executable)
index ea05f01..f87a1d9
@@ -1,3 +1,12 @@
+/*
+ * JavaInspect - Utility to visualize java software
+ * Copyright (C) 2013-2014, 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.methods;
 
 import java.io.BufferedReader;
@@ -8,9 +17,9 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import eu.svjatoslav.inspector.tokenizer.InvalidSyntaxException;
-import eu.svjatoslav.inspector.tokenizer.Tokenizer;
-import eu.svjatoslav.inspector.tokenizer.TokenizerMatch;
+import eu.svjatoslav.commons.string.tokenizer.InvalidSyntaxException;
+import eu.svjatoslav.commons.string.tokenizer.Tokenizer;
+import eu.svjatoslav.commons.string.tokenizer.TokenizerMatch;
 
 public class JavaFile {
 
@@ -22,6 +31,8 @@ public class JavaFile {
 
        StringBuffer contents = new StringBuffer();
 
+       public List<Clazz> classes = new ArrayList<Clazz>();
+
        public JavaFile(final File file) throws IOException, InvalidSyntaxException {
                this.file = file;
                parse();
@@ -49,6 +60,7 @@ public class JavaFile {
                tokenizer.addTerminator("<", false);
                tokenizer.addTerminator(">", false);
                tokenizer.addTerminator(",", false);
+               tokenizer.addTerminator("@", false);
 
                // comments
                tokenizer.addTerminator("//", "\n", true);
@@ -85,6 +97,11 @@ public class JavaFile {
                                continue;
                        }
 
+                       if ("@".equals(match.token)) {
+                               final Annotation annotation = new Annotation(tokenizer);
+                               continue;
+                       }
+
                        System.out.println("    " + modifiers.toString() + " "
                                        + match.token);
                        modifiers.reset();
@@ -99,7 +116,9 @@ public class JavaFile {
                final TokenizerMatch match = tokenizer.getNextToken();
                final Clazz clazz = new Clazz(packageName, match.token, tokenizer,
                                false);
-               System.out.println(clazz.toString());
+               // System.out.println(clazz.toString());
+               classes.add(clazz);
+
        }
 
        private void parseImport(final Tokenizer tokenizer)
@@ -125,7 +144,8 @@ public class JavaFile {
 
                final TokenizerMatch match = tokenizer.getNextToken();
                final Clazz clazz = new Clazz(packageName, match.token, tokenizer, true);
-               System.out.println(clazz.toString());
+               // System.out.println(clazz.toString());
+               classes.add(clazz);
        }
 
        private void parsePackage(final Tokenizer tokenizer)