I’d like to be able to write, for example
Method[] getMethods(Class<?> c)
which would do the same thing as the existing
Class.getMethods()
but also include private and protected methods. Any ideas how I could do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To explain:
getDeclaredMethodsreturns all methods that are declared by a certain class, but not its superclassesc.getSuperclass()returns the immediate superclass of the given classObject, you get all methodsObject, then let the condition bewhile (c != null)