Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1007767 // findMethodsNamed

JavaX fragment (include)

1  
// finds static and non-static methods.
2  
3  
static L<Method> findMethodsNamed(O obj, String method) {
4  
  if (obj == null) ret null;
5  
  ret findMethodsNamed(_getClass(obj), method);
6  
}
7  
8  
static L<Method> findMethodsNamed(Class c, String method) {
9  
  new L<Method> l;
10  
  while (c != null) {
11  
    for (Method m : c.getDeclaredMethods())
12  
      if (m.getName().equals(method)) {
13  
        m.setAccessible(true);
14  
        l.add(m);
15  
      }
16  
    c = c.getSuperclass();
17  
  }
18  
  ret l;
19  
}
20  
21  
22  
23  
static L<Method> findMethodsNamed(String method, O obj) {
24  
  ret findMethodsNamed(obj, method);
25  
}

Author comment

Began life as a copy of #1002796

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1007767
Snippet name: findMethodsNamed
Eternal ID of this version: #1007767/2
Text MD5: 4e58f114216f1b9de3e589a4a1071332
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-09 14:03:38
Source code size: 582 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 584 / 626
Version history: 1 change(s)
Referenced in: [show references]