如何在接口/抽象类上使用反射来获取其所有方法?
答案 0 :(得分:15)
,例如,
MyInterfaceOrAbstractClass.class.getDeclaredMethods();
答案 1 :(得分:6)
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());
}