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

14
LINES

< > BotCompany Repo | #1002180 // hasMethodNamed

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7658L/43K).

1  
// This is a bit rough... finds static and non-static methods.
2  
// It's usually just for error messages though, so no worries.
3  
4  
static boolean hasMethodNamed(O obj, String method) {
5  
  if (obj == null) ret false;
6  
  if (obj instanceof Class)
7  
    ret hasMethodNamed((Class) obj, method);
8  
  ret hasMethodNamed(obj.getClass(), method);
9  
}
10  
11  
static boolean hasMethodNamed(Class c, String method) {
12  
  if (c == null) false;
13  
  ret getMethodCache(c).cache.containsKey(method);
14  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002180
Snippet name: hasMethodNamed
Eternal ID of this version: #1002180/3
Text MD5: 395ac0c3df958cbf99f554b2f6fc5125
Transpilation MD5: 23e1ecae913c6ca7e66a554a8bf6727f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-02 16:07:53
Source code size: 478 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 650 / 1070
Version history: 2 change(s)
Referenced in: [show references]