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

static L<Method> allLiveMethodsBelowClass(O o, Class base) {
  Class c = _getClass(o);
  bool isInstance = c != o;
  new L<Method> methods;
  while (c != null && c != base) {
    for (Method m : c.getDeclaredMethods())
      if (isInstance != isStaticMethod(m))
        methods.add(m);
    c = c.getSuperclass();
  }
  ret methods;
}

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: 148 / 219
Version history: 2 change(s)
Referenced in: [show references]