1 | static Field findField2(Object o, String field) { |
2 | if (o instanceof Class) ret findField2_findStaticField((Class) o, field); |
3 | ret findField2_findField(o.getClass(), field); |
4 | } |
5 | |
6 | static Field findField2_findStaticField(Class<?> c, String field) { |
7 | Class _c = c; |
8 | do { |
9 | for (Field f : _c.getDeclaredFields()) |
10 | if (f.getName().equals(field) && (f.getModifiers() & java.lang.reflect.Modifier.STATIC) != 0) |
11 | return f; |
12 | _c = _c.getSuperclass(); |
13 | } while (_c != null); |
14 | ret null; |
15 | } |
16 | |
17 | static Field findField2_findField(Class<?> c, String field) { |
18 | Class _c = c; |
19 | do { |
20 | for (Field f : _c.getDeclaredFields()) |
21 | if (f.getName().equals(field)) |
22 | return f; |
23 | _c = _c.getSuperclass(); |
24 | } while (_c != null); |
25 | ret null; |
26 | } |
Began life as a copy of #1005305
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1013045 |
Snippet name: | findField2 - unoptimized |
Eternal ID of this version: | #1013045/1 |
Text MD5: | e2551e64182c865c91fdf258164b9e9c |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-12-22 15:57:30 |
Source code size: | 772 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 398 / 433 |
Referenced in: | [show references] |