Ale*_*lex 1 java reflection apache-commons
如何找到使用Apache类中定义的所有可用接口BeanUtils,MethodUtils等等?
public class MyClass() {
.....
public interface Interface1{};
public interface Interface2{};
}
Run Code Online (Sandbox Code Playgroud)
我怀疑你只想要Class.getClasses():
返回一个数组,其中包含Class对象,这些对象表示作为此Class对象所表示的类的成员的所有公共类和接口.这包括从超类继承的公共类和接口成员,以及由类声明的公共类和接口成员.如果此Class对象没有公共成员类或接口,则此方法返回长度为0的数组.如果此Class对象表示基本类型,数组类或void,则此方法还返回长度为0的数组.
所以调用MyClass.class.getClasses(),然后使用过滤掉非接口Class.isInterface.
| 归档时间: |
|
| 查看次数: |
48 次 |
| 最近记录: |