Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可以将 Java 注释限制为字段、方法等。
但是,字段或方法名称或类型呢?
例如,我想创建一个只能放在long类型和名称为id的字段中的注释;
可以使用注释处理器。
一些可能有助于完成此任务的教程:
http://deors.wordpress.com/2011/10/08/annotation-processors/
http://java.dzone.com/news/using-java-6-processors