1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.themis.parser.decl;
18
19 import com.github.javaparser.ast.body.EnumDeclaration;
20 import io.github.tonywasher.joceanus.oceanus.base.OceanusException;
21 import io.github.tonywasher.joceanus.themis.parser.base.ThemisInstance.ThemisClassInstance;
22 import io.github.tonywasher.joceanus.themis.parser.base.ThemisInstance.ThemisDeclarationInstance;
23 import io.github.tonywasher.joceanus.themis.parser.base.ThemisModifierList;
24 import io.github.tonywasher.joceanus.themis.parser.base.ThemisParserDef;
25 import io.github.tonywasher.joceanus.themis.parser.node.ThemisNodeSimpleName;
26
27 import java.util.List;
28
29
30
31
32 public class ThemisDeclEnum
33 extends ThemisBaseDeclaration<EnumDeclaration>
34 implements ThemisDeclarationInstance, ThemisClassInstance {
35
36
37
38 private final String theName;
39
40
41
42
43 private final String theFullName;
44
45
46
47
48 private final ThemisModifierList theModifiers;
49
50
51
52
53 private final List<ThemisDeclarationInstance> theValues;
54
55
56
57
58 private final List<ThemisDeclarationInstance> theBody;
59
60
61
62
63 private final List<ThemisTypeInstance> theImplements;
64
65
66
67
68 private final List<ThemisExpressionInstance> theAnnotations;
69
70
71
72
73
74
75
76
77 ThemisDeclEnum(final ThemisParserDef pParser,
78 final EnumDeclaration pDeclaration) throws OceanusException {
79
80 super(pParser, pDeclaration);
81 theName = ((ThemisNodeSimpleName) pParser.parseNode(pDeclaration.getName())).getName();
82 theFullName = pDeclaration.getFullyQualifiedName().orElse(null);
83 theModifiers = pParser.parseModifierList(pDeclaration.getModifiers());
84 theAnnotations = pParser.parseExprList(pDeclaration.getAnnotations());
85 theImplements = pParser.parseTypeList(pDeclaration.getImplementedTypes());
86 theValues = pParser.parseDeclarationList(pDeclaration.getEntries());
87
88
89 pParser.registerClass(this);
90
91
92 theBody = pParser.parseDeclarationList(pDeclaration.getMembers());
93 }
94
95 @Override
96 public String getName() {
97 return theName;
98 }
99
100 @Override
101 public String getFullName() {
102 return theFullName;
103 }
104
105 @Override
106 public boolean isTopLevel() {
107 return getNode().isTopLevelType();
108 }
109
110 @Override
111 public ThemisModifierList getModifiers() {
112 return theModifiers;
113 }
114
115
116
117
118
119
120 public List<ThemisDeclarationInstance> getValues() {
121 return theValues;
122 }
123
124 @Override
125 public List<ThemisDeclarationInstance> getBody() {
126 return theBody;
127 }
128
129 @Override
130 public List<ThemisTypeInstance> getImplements() {
131 return theImplements;
132 }
133
134 @Override
135 public List<ThemisExpressionInstance> getAnnotations() {
136 return theAnnotations;
137 }
138 }