APT(注释处理工具) [英] APT (Annotation Processing Tool)
问题描述
我试图找到一个简单的例子来理解 apt 命令的用法,但我找不到有用的资源.
I was trying to find simple example to understand the usage of apt command, but I couldn't find a helpful resource for this.
我参考了这个注释处理入门工具 但我确实得到了高层次的理解.此外,我想编写一个代码来测试 apt 命令.有人可以发布一个简单的示例或更好的链接以供参考吗?
I have referred this Getting Started with the Annotation Processing Tool but I do get a high level understanding. Moreover I want to write a code to test apt command. Can somebody post a simple example or better link to refer?
推荐答案
以下是创建 Note
注释和关联处理器的示例:
Here's an example of creating a Note
annotation and associated processor:
更新.从 Java 1.7 开始:
JSR 269,也称为语言模型 API,有两个基本部分:一个为 Java 编程语言建模的 API,一个用于编写注释处理器的 API.此功能可通过 javac 命令的新选项访问;通过包含 JSR 269 支持,javac 现在的行为类似于 JDK 5 中的 apt 命令.
JSR 269, also known as the Language Model API, has two basic pieces: an API that models the Java programming language, and an API for writing annotation processors. This functionality is accessed through new options to the javac command; by including JSR 269 support, javac now acts analogously to the apt command in JDK 5.
这篇关于APT(注释处理工具)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!