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

18
LINES

< > BotCompany Repo | #1007855 // findMethodsNamed2 - static or all

JavaX fragment (include)

1  
static L<Method> findMethodsNamed2(O obj, S method, bool staticOnly) {
2  
  if (obj == null) ret null;
3  
  ret findMethodsNamed2(_getClass(obj), method, staticOnly);
4  
}
5  
6  
static L<Method> findMethodsNamed2(Class c, S method, bool staticOnly) {
7  
  new L<Method> l;
8  
  while (c != null) {
9  
    for (Method m : c.getDeclaredMethods())
10  
      if (m.getName().equals(method) &&
11  
        (!staticOnly || (m.getModifiers() & Modifier.STATIC) != 0)) {
12  
        m.setAccessible(true);
13  
        l.add(m);
14  
      }
15  
    c = c.getSuperclass();
16  
  }
17  
  ret l;
18  
}

Author comment

Began life as a copy of #1007767

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: #1007855
Snippet name: findMethodsNamed2 - static or all
Eternal ID of this version: #1007855/1
Text MD5: 8eaa2e3faec5b6651f109e1e7d5091e4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-11 23:06:35
Source code size: 547 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 366 / 394
Referenced in: [show references]