KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > annotation > AnnotationInfo


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.deployment.annotation;
25
26 import java.lang.reflect.AnnotatedElement JavaDoc;
27 import java.lang.annotation.Annotation JavaDoc;
28 import java.lang.annotation.ElementType JavaDoc;
29
30 /**
31  * Instances encapsulate all information necessary for an AnnotationHandler
32  * to process an annotation. In particular, instances of this class provide
33  * access to :
34  *
35  * <p>
36  * <li> the Annotation instance
37  * <li> the ProcessingContext of the tool
38  * <li> the AnnotatedElement which is a reference to the annotation element
39  * (Type, Method...).
40  * </p>
41  *
42  * @see java.lang.annotation.Annotation, java.lang.reflect.AnnotatedElement
43  *
44  * @author Jerome Dochez
45  *
46  */

47 public class AnnotationInfo {
48
49     // the annotated element
50
final private AnnotatedElement JavaDoc annotatedElement;
51
52     // the annotation
53
final private Annotation JavaDoc annotation;
54     
55     // the processing context
56
final private ProcessingContext context;
57     
58     // the element type
59
final private ElementType JavaDoc type;
60
61     /**
62      * Creates a new instance of AnnotationInfo with all the information
63      * necessary to process an annotation.
64      *
65      * @param context the annotation processor processing context
66      * @param element the annotated element
67      * @param annotation the annotation
68      */

69     public AnnotationInfo(ProcessingContext context, AnnotatedElement JavaDoc element,
70             Annotation JavaDoc annotation, ElementType JavaDoc type) {
71         
72         this.context = context;
73         this.annotatedElement = element;
74         this.annotation = annotation;
75         this.type = type;
76     }
77
78     /**
79      * @return the annotated element instance
80      */

81     public AnnotatedElement JavaDoc getAnnotatedElement() {
82         return annotatedElement;
83     }
84
85     /**
86      * @return the annotation instance
87      */

88     public Annotation JavaDoc getAnnotation() {
89
90         return annotation;
91     }
92
93     
94     /**
95      * @return the processing context
96      */

97     public ProcessingContext getProcessingContext() {
98         return context;
99     }
100     
101     /**
102      * @return the annotated element ElementType
103      */

104     public ElementType JavaDoc getElementType() {
105         return type;
106     }
107 }
108
Popular Tags