开发者

Get all methods of an Interface or Abstract class using Reflection

How can I use ref开发者_如何学编程lection on an interface/abstract class to get all of its methods?


E.g.,

MyInterfaceOrAbstractClass.class.getDeclaredMethods();


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());
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜