// This is a bit rough... finds static and non-static methods. static Method findMethodNamed(O obj, String method) { if (obj == null) ret null; if (obj instanceof Class) ret findMethodNamed((Class) obj, method); ret findMethodNamed(obj.getClass(), method); } static Method findMethodNamed(Class c, String method) { while (c != null) { for (Method m : c.getDeclaredMethods()) if (m.getName().equals(method)) { makeAccessible(m); ret m; } c = c.getSuperclass(); } ret null; }
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: | 746 / 795 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1007767 - findMethodsNamed #1030141 - implementsCustomToString #3000382 - Answer for ferdie (>> t = 1, f = 0) |