d262061f490531ec6444d9e8a4e4a70525f121db
[javainspect.git] / src / main / java / eu / svjatoslav / inspector / java / methods / Annotation.java
1 package eu.svjatoslav.inspector.java.methods;
2
3 import eu.svjatoslav.inspector.tokenizer.InvalidSyntaxException;
4 import eu.svjatoslav.inspector.tokenizer.Tokenizer;
5 import eu.svjatoslav.inspector.tokenizer.TokenizerMatch;
6
7 public class Annotation {
8
9         private String name;
10
11         public Annotation(final Tokenizer tokenizer) throws InvalidSyntaxException {
12
13                 name = tokenizer.getNextToken().token;
14
15                 if (!tokenizer.probeNextToken("("))
16                         return;
17
18                 int depth = 1;
19
20                 while (true) {
21                         final TokenizerMatch token = tokenizer.getNextToken();
22
23                         if ("(".equals(token.token))
24                                 depth++;
25                         if (")".equals(token.token))
26                                 depth--;
27
28                         if (depth == 0)
29                                 return;
30                 }
31
32         }
33
34 }