1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.github.tonywasher.joceanus.themis.solver.reflect;
18
19 import io.github.tonywasher.joceanus.themis.parser.base.ThemisInstance.ThemisClassInstance;
20 import io.github.tonywasher.joceanus.themis.parser.base.ThemisModifierList;
21 import io.github.tonywasher.joceanus.themis.parser.node.ThemisNodeImport;
22 import io.github.tonywasher.joceanus.themis.parser.node.ThemisNodeModifierList;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27
28
29
30 public class ThemisReflectExternal
31 implements ThemisClassInstance {
32
33
34
35 static final String JAVALANG = "java.lang.";
36
37
38
39
40 private final String theName;
41
42
43
44
45 private final String theFullName;
46
47
48
49
50 private final ThemisModifierList theModifiers;
51
52
53
54
55 private final List<String> theAncestors;
56
57
58
59
60 private ThemisClassInstance theClassInstance;
61
62
63
64
65
66
67 public ThemisReflectExternal(final ThemisNodeImport pImport) {
68 theName = pImport.getShortName();
69 theFullName = pImport.getFullName();
70 theModifiers = new ThemisNodeModifierList(new ArrayList<>());
71 theAncestors = new ArrayList<>();
72 }
73
74
75
76
77
78
79 ThemisReflectExternal(final ThemisClassInstance pClazz) {
80 theName = pClazz.getName();
81 theFullName = pClazz.getFullName();
82 theModifiers = pClazz.getModifiers();
83 theAncestors = new ArrayList<>();
84 theClassInstance = pClazz;
85 }
86
87 @Override
88 public String getName() {
89 return theName;
90 }
91
92 @Override
93 public String getFullName() {
94 return theFullName;
95 }
96
97 @Override
98 public ThemisModifierList getModifiers() {
99 return theModifiers;
100 }
101
102 @Override
103 public boolean isTopLevel() {
104 return true;
105 }
106
107
108
109
110
111
112 public ThemisClassInstance getClassInstance() {
113 return theClassInstance;
114 }
115
116
117
118
119
120
121 public void setClassInstance(final ThemisClassInstance pClassInstance) {
122 theClassInstance = pClassInstance;
123 }
124
125
126
127
128
129
130 public List<String> getAncestors() {
131 return theAncestors;
132 }
133
134
135
136
137
138
139 public void addAncestor(final ThemisReflectExternal pAncestor) {
140 theAncestors.add(pAncestor.getFullName());
141 }
142 }