是否可以使用反射在包中获取公共接口和类的集合? [英] Is it possible to get a collection of public interfaces and classes in a package using reflection?

查看:32
本文介绍了是否可以使用反射在包中获取公共接口和类的集合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用反射获取给定包中的公共接口和类的集合?问题是针对 Java 1.6

Is it possible to get a collection of public interfaces and classes in a given package using reflection? Question is for Java 1.6

为什么:我有一个包,其中注释了一些类.我想自动收集它们以进行记录

Why: I have a package where some classes are annotated. I want to collect them automcatically for documenting

推荐答案

你真的需要在运行时生成文档吗?注解处理工具(APT)的正常使用方法:http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/guide/apt/GettingStarted.html

Do you really have to generate the documentation at runtime? The normal way to use the annotation processing tool (APT): http://download.oracle.com/docs/cd/E17476_01/javase/1.5.0/docs/guide/apt/GettingStarted.html

这篇关于是否可以使用反射在包中获取公共接口和类的集合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆