Search code examples
javaannotationsjava-6annotation-processing

Resource for annotation processing


I'm looking desperately for a valuable resource on Java 6 annotation processing. Ideally, the different points I would like to be addressed should be:

  • The various Element interfaces and how to retrieve them from a class structure
  • How to link a Processor to an annotation
  • How to build an annotation, with the Processor, for example in the form of jar file
  • How to make all this in Eclipse

Do you any resource which could match the bill?


Solution

  • This guide to modern, static, annotation processing is very easy to follow and has a video corollary to boot:

    Blog post: http://hannesdorfmann.com/annotation-processing/annotationprocessing101

    Video Talk: https://www.youtube.com/watch?v=43FFfTyDYEg

    I strongly recommend a static approach to annotation processing, as it yields advantages such as:

    • Avoiding reflection.
    • Compatibility with both Java and Android.

    Also it is pretty cool.