KickJava   Java API By Example, From Geeks To Geeks.

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


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.annotation.Annotation JavaDoc;
27
28 /**
29  * This interface defines the contract for annotation handlers
30  * and the annotation processing engine. Each annotation handler
31  * is registered for a particular annotation type and will be
32  * called by the engine when such annotation type is encountered.
33  *
34  * The AnnotationHandler is a stateless object, no state should
35  * be stored, instead users should use the ProcessingContext.
36  *
37  * Annotation can be defined or processed in random orders on a
38  * particular type, however, a particular annotation may need
39  * other annotation to be processed before itself in order to be
40  * processed successfully. An annotation type can indicate through
41  * the @see getAnnotations() method which annotation types should
42  * be processed before itself.
43  *
44  * @author Jerome Dochez
45  */

46 public interface AnnotationHandler {
47     
48     /**
49      * @return the annoation type this annotation handler is handling
50      */

51     public Class JavaDoc<? extends Annotation JavaDoc> getAnnotationType();
52     
53     /**
54      * Process a particular annotation which type is the same as the
55      * one returned by @see getAnnotationType(). All information
56      * pertinent to the annotation and its context is encapsulated
57      * in the passed AnnotationInfo instance.
58      *
59      * @param element the annotation information
60      */

61     public HandlerProcessingResult processAnnotation(AnnotationInfo element)
62         throws AnnotationProcessorException;
63     
64     /**
65      * @return an array of annotation types this annotation handler would
66      * require to be processed (if present) before it processes it's own
67      * annotation type.
68      */

69     public Class JavaDoc<? extends Annotation JavaDoc>[] getTypeDependencies();
70         
71 }
72
Popular Tags