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

25
LINES

< > BotCompany Repo | #1007767 // findMethodsNamed

JavaX fragment (include)

// finds static and non-static methods.

static L<Method> findMethodsNamed(O obj, String method) {
  if (obj == null) ret null;
  ret findMethodsNamed(_getClass(obj), method);
}

static L<Method> findMethodsNamed(Class c, String method) {
  new L<Method> l;
  while (c != null) {
    for (Method m : c.getDeclaredMethods())
      if (m.getName().equals(method)) {
        m.setAccessible(true);
        l.add(m);
      }
    c = c.getSuperclass();
  }
  ret l;
}



static L<Method> findMethodsNamed(String method, O obj) {
  ret findMethodsNamed(obj, method);
}

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: 594 / 636
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1007831 - findStaticMethodsNamed
#1007855 - findMethodsNamed2 - static or all
#1021665 - findMCMethodsNamed
#1028402 - findMethodsNamed_nonSynthetic
#1035278 - findMethodsNamed_cached