Get all methods of an interface or abstract class using Reflection

How can I use reflection in an interface / abstract class to get all its methods?

+3
source share
2 answers

For instance,

MyInterfaceOrAbstractClass.class.getDeclaredMethods();
+13
source
Class clazz = Something.class;
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
    // do what you have to do with the method
    System.out.println(method.getName());
}
+4
source

All Articles