注释处理工具<-检查有效注释
我
@ColumnMetadata(index=1)
...
@ColumnMetadata(index=2)
...
@ColumnMetadata(index=3)
...
必须使用 APT 检查索引号是否唯一。我不知道该怎么做。我看不懂教程,一般在网上找资料都遇到问题。
如何做到这一点?有任何关于 APT 的教程/任何内容吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想要使用可插入注释 API,它是 apt 工具的后继者。这是一个简短的入门教程: Java 6.0 功能第 - 2 部分:可插入注释处理 API
这大致是检查注释所需执行的步骤:
@SupportedAnnotationTypes(value= {"full.name.of.ColumnMetadata"})
process
方法。You probably want to use the pluggable annotation API, the successor of the apt tool. Here's a short tutorial to get started: Java 6.0 Features Part – 2 : Pluggable Annotation Processing API
This are roughly the steps you need to do to check your annotations:
@SupportedAnnotationTypes(value= {"full.name.of.ColumnMetadata"})
process
method.