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

21
LINES

< > BotCompany Repo | #1015791 // maxNumberOfMethodArguments

JavaX fragment (include)

static Int maxNumberOfMethodArguments(O o, S method) {
  Class c;
  bool mustBeStatic = false;
  if (o instanceof Class) {
    c = (Class) o;
    mustBeStatic = true;
  } else
    c = o.getClass();
      
  Class _c = c;
  int n = -1;
  while (c != null) {
    for (Method m : c.getDeclaredMethods()) {
      if (!m.getName().equals(method)) continue;
      if (mustBeStatic && !methodIsStatic(m)) continue;
      n = max(n, l(m.getParameterTypes()));
    }
    c = c.getSuperclass();
  }
  ret n < 0 ? null : n;
}

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: 342 / 406
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)