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)

static L<Method> findMethodsNamed2(O obj, S method, bool staticOnly) {
  if (obj == null) ret null;
  ret findMethodsNamed2(_getClass(obj), method, staticOnly);
}

static L<Method> findMethodsNamed2(Class c, S method, bool staticOnly) {
  new L<Method> l;
  while (c != null) {
    for (Method m : c.getDeclaredMethods())
      if (m.getName().equals(method) &&
        (!staticOnly || (m.getModifiers() & Modifier.STATIC) != 0)) {
        m.setAccessible(true);
        l.add(m);
      }
    c = c.getSuperclass();
  }
  ret l;
}

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: 362 / 389
Referenced in: [show references]