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

1  
static TreeSet<Int> numbersOfMethodArguments(O o, S method, O... _) {
2  
  boolPar noVarArgs;
3  
  Class c;
4  
  bool mustBeStatic = false;
5  
  if (o instanceof Class) {
6  
    c = (Class) o;
7  
    mustBeStatic = true;
8  
  } else
9  
    c = o.getClass();
10  
      
11  
  new TreeSet<Int> numbers;
12  
  while (c != null) {
13  
    for (Method m : c.getDeclaredMethods()) {
14  
      if (!m.getName().equals(method)) continue;
15  
      if (mustBeStatic && !methodIsStatic(m)) continue;
16  
      if (noVarArgs && m.isVarArgs()) continue;
17  
      numbers.add(l(m.getParameterTypes()));
18  
    }
19  
    c = c.getSuperclass();
20  
  }
21  
  ret numbers;
22  
}

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: 563 / 580
Version history: 3 change(s)
Referenced in: [show references]