从 XDoclet 到注释的自动转换

发布于 2024-08-16 00:51:16 字数 98 浏览 2 评论 0原文

有谁知道一种以自动方式将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感性 2024-08-23 00:51:16

顺便说一句,我不知道有什么可以做到这一点。但是,可以编写: 每个 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文