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

21
LINES

< > BotCompany Repo | #1015791 // maxNumberOfMethodArguments

JavaX fragment (include)

1  
static Int maxNumberOfMethodArguments(O o, S method) {
2  
  Class c;
3  
  bool mustBeStatic = false;
4  
  if (o instanceof Class) {
5  
    c = (Class) o;
6  
    mustBeStatic = true;
7  
  } else
8  
    c = o.getClass();
9  
      
10  
  Class _c = c;
11  
  int n = -1;
12  
  while (c != null) {
13  
    for (Method m : c.getDeclaredMethods()) {
14  
      if (!m.getName().equals(method)) continue;
15  
      if (mustBeStatic && !methodIsStatic(m)) continue;
16  
      n = max(n, l(m.getParameterTypes()));
17  
    }
18  
    c = c.getSuperclass();
19  
  }
20  
  ret n < 0 ? null : n;
21  
}

Author comment

Began life as a copy of #1008683

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1015791
Snippet name: maxNumberOfMethodArguments
Eternal ID of this version: #1015791/2
Text MD5: 453b351d3979076e697898b3ebab1c79
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-27 21:04:13
Source code size: 534 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 274 / 331
Version history: 1 change(s)
Referenced in: [show references]