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

19
LINES

< > BotCompany Repo | #1002795 // findMethod

JavaX fragment (include)

1  
static Method findMethod(O o, S method, O... args) {
2  
  ret findMethod_cached(o, method, args);
3  
}
4  
5  
static boolean findMethod_checkArgs(Method m, Object[] args, boolean debug) {
6  
  Class<?>[] types = m.getParameterTypes();
7  
  if (types.length != args.length) {
8  
    if (debug)
9  
      System.out.println("Bad parameter length: " + args.length + " vs " + types.length);
10  
    return false;
11  
  }
12  
  for (int i = 0; i < types.length; i++)
13  
    if (!(args[i] == null || isInstanceX(types[i], args[i]))) {
14  
      if (debug)
15  
        System.out.println("Bad parameter " + i + ": " + args[i] + " vs " + types[i]);
16  
      return false;
17  
    }
18  
  return true;
19  
}

Author comment

Began life as a copy of #1001199

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002795
Snippet name: findMethod
Eternal ID of this version: #1002795/2
Text MD5: e4b117494125d4ae9fc15a2cb887ffa8
Author: stefan
Category:
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-16 20:58:34
Source code size: 653 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 719 / 697
Version history: 1 change(s)
Referenced in: [show references]