KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > processing > AnnotationProcessor


1 package spoon.processing;
2
3 import java.lang.annotation.Annotation JavaDoc;
4 import java.util.Set JavaDoc;
5
6 import spoon.reflect.declaration.CtElement;
7
8 /**
9  * This interface defines an annotation processor. An annotation processor is
10  * triggered by Spoon when a visited element is annotated with one of the
11  * processed or consumed annotations. To define a new annotation processor, the
12  * user should subclass {@link spoon.processing.AbstractAnnotationProcessor},
13  * the abstract default implementation of this interface.
14  */

15 public interface AnnotationProcessor<A extends Annotation JavaDoc, E extends CtElement>
16         extends Processor<E> {
17
18     /**
19      * Do the annotation processing job for a given annotation.
20      *
21      * @param annotation the annotation to process
22      * @param element the element that holds the processed annotations
23      */

24     void process(A annotation, E element);
25
26     /**
27      * Gets the annotations processed by this annotation processor, that is to
28      * say the annotation types that trigger the
29      * {@link #process(Annotation, CtElement)} method when visiting a program
30      * element. The processed annotation types includes all the consumed
31      * annotation types.
32      *
33      * @return the annotation classes
34      */

35     Set JavaDoc<Class JavaDoc<? extends A>> getProcessedAnnotationTypes();
36
37     /**
38      * Gets the annotations types consumed by this processor. A consumed
39      * annotation is a special kind of processed annotation (see
40      * {@link #getProcessedAnnotationTypes()} that is automatically removed from
41      * the program once the associated processor has finished its job.
42      *
43      * @return the annotation classes
44      */

45     Set JavaDoc<Class JavaDoc<? extends A>> getConsumedAnnotationTypes();
46
47     /**
48      * Returns true (default) if the processor automatically infers the consumed
49      * annotation type to the <code>A</code> actual type.
50      */

51     boolean inferConsumedAnnotationType();
52
53 }
54
Popular Tags