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

22
LINES

< > BotCompany Repo | #1011489 // numbersOfMethodArguments

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

Libraryless. Click here for Pure Java version (2271L/14K).

static TreeSet<Int> numbersOfMethodArguments(O o, S method, O... _) {
  boolPar noVarArgs;
  Class c;
  bool mustBeStatic = false;
  if (o instanceof Class) {
    c = (Class) o;
    mustBeStatic = true;
  } else
    c = o.getClass();
      
  new TreeSet<Int> numbers;
  while (c != null) {
    for (Method m : c.getDeclaredMethods()) {
      if (!m.getName().equals(method)) continue;
      if (mustBeStatic && !methodIsStatic(m)) continue;
      if (noVarArgs && m.isVarArgs()) continue;
      numbers.add(l(m.getParameterTypes()));
    }
    c = c.getSuperclass();
  }
  ret numbers;
}

Author comment

Began life as a copy of #1008683

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011489
Snippet name: numbersOfMethodArguments
Eternal ID of this version: #1011489/4
Text MD5: c137d085ab19765d30fa88000fbe8ce3
Transpilation MD5: 8bcd7a341763cec2c81faf457a87307e
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-26 14:09:21
Source code size: 609 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 564 / 582
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)