• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reflection getMethods()  RSS feed

 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to get just the methods defined by that class? and not get all the methods from classes it extends (like Object)?
or is there a way to differentiate where the method was defined using the Method Class? There is a method isSynthetic() and I haven't quite been able to figure out what that means.

-Tad
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at Class.getDeclaredMethods(), which returns only the Methods defined in that class.

A synthetic method is one added by the compiler to implement some language feature, as opposed to one you yourself wrote. Stay away from them. They don't like to be bothered.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!