1 | // This is a bit rough... finds static and non-static methods. |
2 | |
3 | static Method findMethodNamed(O obj, String method) {
|
4 | if (obj == null) ret null; |
5 | if (obj instanceof Class) |
6 | ret findMethodNamed((Class) obj, method); |
7 | ret findMethodNamed(obj.getClass(), method); |
8 | } |
9 | |
10 | static Method findMethodNamed(Class c, String method) {
|
11 | while (c != null) {
|
12 | for (Method m : c.getDeclaredMethods()) |
13 | if (m.getName().equals(method)) {
|
14 | makeAccessible(m); |
15 | ret m; |
16 | } |
17 | c = c.getSuperclass(); |
18 | } |
19 | ret null; |
20 | } |
Began life as a copy of #1002180
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: | #1002796 |
| Snippet name: | findMethodNamed |
| Eternal ID of this version: | #1002796/2 |
| Text MD5: | d4456f240c65b97cb6aeebb8a79bfd7f |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-08-31 14:49:46 |
| Source code size: | 546 bytes / 20 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1088 / 1134 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |