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).

// This is a bit rough... finds static and non-static methods.
// It's usually just for error messages though, so no worries.

static boolean hasMethodNamed(O obj, String method) {
  if (obj == null) ret false;
  if (obj instanceof Class)
    ret hasMethodNamed((Class) obj, method);
  ret hasMethodNamed(obj.getClass(), method);
}

static boolean hasMethodNamed(Class c, String method) {
  if (c == null) false;
  ret getMethodCache(c).cache.containsKey(method);
}

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: 649 / 1069
Version history: 2 change(s)
Referenced in: [show references]