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

12
LINES

< > BotCompany Repo | #1031516 // allLiveMethodsBelowClass - does not return static methods if you pass an instance. returns only methods declared or overridden below the named class

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

Libraryless. Click here for Pure Java version (81L/1K).

1  
static L<Method> allLiveMethodsBelowClass(O o, Class base) {
2  
  Class c = _getClass(o);
3  
  bool isInstance = c != o;
4  
  new L<Method> methods;
5  
  while (c != null && c != base) {
6  
    for (Method m : c.getDeclaredMethods())
7  
      if (isInstance != isStaticMethod(m))
8  
        methods.add(m);
9  
    c = c.getSuperclass();
10  
  }
11  
  ret methods;
12  
}

Author comment

Began life as a copy of #1016496

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1031516
Snippet name: allLiveMethodsBelowClass - does not return static methods if you pass an instance. returns only methods declared or overridden below the named class
Eternal ID of this version: #1031516/3
Text MD5: e1684eef1cf61173a784d550ad33132c
Transpilation MD5: 32149193e74b4f6665cc55addbd9c5d8
Author: stefan
Category: javax / introspection
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-18 15:29:16
Source code size: 344 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 149 / 224
Version history: 2 change(s)
Referenced in: [show references]