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: 477 / 517
Version history: 1 change(s)
Referenced in: [show references]