从 XDoclet 到注释的自动转换
有谁知道一种以自动方式将 xdoclet 转换为注释的方法?在我看来,对于 xdoclet 所做的任何事情都应该可以有等效的注释/注释预处理器,但在大型系统上手动转换内容确实很乏味。
Does anybody know of a way to convert xdoclet to annotations in an automated fashion? It seems to me that it should be possible to have equivalent annotations/annotation preprocessors for anything that xdoclet does but manually converting things is really tedious on large systems.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
顺便说一句,我不知道有什么可以做到这一点。但是,可以编写: 每个 JavaDoc 对象(例如 MethodDoc) 提供了position()方法,该方法给出了关联声明的源位置。按行将整个源文件读取到 ArrayList 中,对于每个标记,在关联行前面添加适当的注释(您不想向列表中添加新行,因为这会导致计数丢失),然后将文件写回出去。
这是一个有趣的解决方案,但我怀疑从长远来看,手动执行一次一组标签会更好。
Offhand I don't know of anything that does this. However, it is possible to write: every JavaDoc object (such as MethodDoc) provides the position() method, which gives the source position of the associated declaration. Read the entire source file into an ArrayList by lines, for each tag prepend the appropriate annotation to the associated line (you don't want to add new lines to the list, because that would throw off the counts), then write the file back out.
An interesting solution, but I suspect that it will be better over the long run to do it manually, one set of tags at a time.