1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub struct ClassFlags(pub(crate) u16);
7
8#[derive(Debug, Clone, Copy)]
11pub struct InnerClassFlags(u16);
12
13#[derive(Debug, Clone, Copy)]
16pub struct MethodFlags(u16);
17
18#[derive(Debug, Clone, Copy)]
20pub struct MethodParamFlags(u16);
21
22#[derive(Debug, Clone, Copy)]
25pub struct FieldFlags(u16);
26
27impl ClassFlags {
28 pub fn new(value: u16) -> Self {
29 Self(value)
30 }
31
32 pub fn is_public(&self) -> bool {
33 self.0 & 0x0001 != 0
34 }
35
36 pub fn is_final(&self) -> bool {
37 self.0 & 0x0010 != 0
38 }
39
40 pub fn is_super(&self) -> bool {
41 self.0 & 0x0020 != 0
42 }
43
44 pub fn is_interface(&self) -> bool {
45 self.0 & 0x0200 != 0
46 }
47
48 pub fn is_abstract(&self) -> bool {
49 self.0 & 0x0400 != 0
50 }
51
52 pub fn is_synthetic(&self) -> bool {
53 self.0 & 0x1000 != 0
54 }
55
56 pub fn is_annotation(&self) -> bool {
57 self.0 & 0x2000 != 0
58 }
59
60 pub fn is_enum(&self) -> bool {
61 self.0 & 0x4000 != 0
62 }
63
64 pub fn is_module(&self) -> bool {
65 self.0 & 0x8000 != 0
66 }
67
68 pub fn get_raw(&self) -> &u16 {
69 &self.0
70 }
71
72 pub fn get_raw_i32(&self) -> i32 {
73 self.0 as i32
74 }
75}
76
77impl InnerClassFlags {
78 pub fn new(value: u16) -> Self {
79 Self(value)
80 }
81
82 pub fn is_public(&self) -> bool {
83 self.0 & 0x0001 != 0
84 }
85
86 pub fn is_private(&self) -> bool {
87 self.0 & 0x0002 != 0
88 }
89
90 pub fn is_protected(&self) -> bool {
91 self.0 & 0x0004 != 0
92 }
93
94 pub fn is_static(&self) -> bool {
95 self.0 & 0x0008 != 0
96 }
97
98 pub fn is_final(&self) -> bool {
99 self.0 & 0x0010 != 0
100 }
101
102 pub fn is_interface(&self) -> bool {
103 self.0 & 0x0200 != 0
104 }
105
106 pub fn is_abstract(&self) -> bool {
107 self.0 & 0x0400 != 0
108 }
109
110 pub fn is_synthetic(&self) -> bool {
111 self.0 & 0x1000 != 0
112 }
113
114 pub fn is_annotation(&self) -> bool {
115 self.0 & 0x2000 != 0
116 }
117
118 pub fn is_enum(&self) -> bool {
119 self.0 & 0x4000 != 0
120 }
121
122 pub fn get_raw(&self) -> &u16 {
123 &self.0
124 }
125}
126
127impl MethodFlags {
128 pub fn new(value: u16) -> Self {
129 Self(value)
130 }
131
132 pub fn is_public(&self) -> bool {
133 self.0 & 0x0001 != 0
134 }
135
136 pub fn is_private(&self) -> bool {
137 self.0 & 0x0002 != 0
138 }
139
140 pub fn is_protected(&self) -> bool {
141 self.0 & 0x0004 != 0
142 }
143
144 pub fn is_static(&self) -> bool {
145 self.0 & 0x0008 != 0
146 }
147
148 pub fn is_final(&self) -> bool {
149 self.0 & 0x0010 != 0
150 }
151
152 pub fn is_synchronized(&self) -> bool {
153 self.0 & 0x0020 != 0
154 }
155
156 pub fn is_bridge(&self) -> bool {
157 self.0 & 0x0040 != 0
158 }
159
160 pub fn is_varargs(&self) -> bool {
161 self.0 & 0x0080 != 0
162 }
163
164 pub fn is_native(&self) -> bool {
165 self.0 & 0x0100 != 0
166 }
167
168 pub fn is_abstract(&self) -> bool {
169 self.0 & 0x0400 != 0
170 }
171
172 pub fn is_strict(&self) -> bool {
173 self.0 & 0x0800 != 0
174 }
175
176 pub fn is_synthetic(&self) -> bool {
177 self.0 & 0x1000 != 0
178 }
179
180 pub fn get_raw(&self) -> &u16 {
181 &self.0
182 }
183}
184
185impl MethodParamFlags {
186 pub fn new(value: u16) -> Self {
187 Self(value)
188 }
189
190 pub fn is_final(&self) -> bool {
191 self.0 & 0x0010 != 0
192 }
193
194 pub fn is_synthetic(&self) -> bool {
195 self.0 & 0x1000 != 0
196 }
197
198 pub fn is_mandated(&self) -> bool {
199 self.0 & 0x8000 != 0
200 }
201
202 pub fn get_raw(&self) -> &u16 {
203 &self.0
204 }
205}
206
207impl FieldFlags {
208 pub fn new(value: u16) -> Self {
209 Self(value)
210 }
211
212 pub fn is_public(&self) -> bool {
213 self.0 & 0x0001 != 0
214 }
215
216 pub fn is_private(&self) -> bool {
217 self.0 & 0x0002 != 0
218 }
219
220 pub fn is_protected(&self) -> bool {
221 self.0 & 0x0004 != 0
222 }
223
224 pub fn is_static(&self) -> bool {
225 self.0 & 0x0008 != 0
226 }
227
228 pub fn is_final(&self) -> bool {
229 self.0 & 0x0010 != 0
230 }
231
232 pub fn is_volatile(&self) -> bool {
233 self.0 & 0x0040 != 0
234 }
235
236 pub fn is_transient(&self) -> bool {
237 self.0 & 0x0080 != 0
238 }
239
240 pub fn is_synthetic(&self) -> bool {
241 self.0 & 0x1000 != 0
242 }
243
244 pub fn is_enum(&self) -> bool {
245 self.0 & 0x4000 != 0
246 }
247
248 pub fn get_raw(&self) -> &u16 {
249 &self.0
250 }
251}