pro*_*ewb 8 java interface class
我一直试图这样做很长一段时间,似乎无法获得所需的输出.
我想做的是有一个班级名称 java.util.Vector
得到:
java.util.Vector.任何帮助,将不胜感激.
虽然 java.util.Vector 不是一个接口,因此您无法使用接口扩展它,但您可以做的是使用像Reflections这样的库来适应这些类型的功能。 反射允许您扫描类路径并查询一组条件,例如实现或扩展给定类/接口的条件。我已经在几个需要扫描接口实现和带注释的类的项目中成功使用了它。
这是明确的链接: http: //code.google.com/p/reflections/
此外,如果您只是想找出类扩展/实现的类/接口,您可以通过 class 属性使用类反射 api。
以下是一些示例:
//get all public methods of Vector
Vector.class.getMethods();
//get all methods of the superclass (AbstractList) of Vector
Vector.class.getSuperclass().getMethods();
//get all interfaces implemented by Vector
Vector.class.getInterfaces();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2387 次 |
| 最近记录: |