How to create a custom Annotation and processing i

2019-07-21 08:41发布

问题:

I'm new to 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.
I read some articles based on APT but no one gives the details about how to process the Annotation.
Are there any tutorials with sample code for processing custom Annotations?

Thanks

回答1:

Start with... the apt getting started guide. 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: o.h.j.JPAMetaModelEntityProcessor.java