简体   繁体   English

如何创建自定义注释并使用APT处理它?

[英]How to create a custom Annotation and processing it using APT?

I'm new to Java Annotation. 我是Java Annotation的新手。 I know how to create custom annotation but I don't know how to process that Annotation to generate the dynamic code just like ejb 3.0 and hibernate does. 我知道如何创建自定义批注,但我不知道如何像ejb 3.0和hibernate一样处理该批注以生成动态代码。
I read some articles based on APT but no one gives the details about how to process the Annotation. 我阅读了一些基于APT的文章,但没有人提供有关如何处理注释的详细信息。
Are there any tutorials with sample code for processing custom Annotations? 是否有带有示例代码的教程来处理自定义注释?

Thanks 谢谢

Start with... the apt getting started guide . 从... apt入门指南开始 To go further, you could maybe have a look at the sources of annotation processor used by JPA 2.0 providers to generate the static meta model classes, for example Hibernate's one: ohjJPAMetaModelEntityProcessor.java 为了进一步ohjJPAMetaModelEntityProcessor.java ,您也许可以看看JPA 2.0提供程序用来生成静态元模型类的注释处理器的来源,例如Hibernate的一个: ohjJPAMetaModelEntityProcessor.java

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM