KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.Set JavaDoc;
27
28 /**
29  * This interface defines the context for the annotation procesing
30  * handler. There is only one context instance per AnnotationProcessor
31  * invocation.
32  *
33  * @author Jerome Dochez
34  */

35 public interface ProcessingContext {
36     
37     /**
38      * Returns the AnnotationProcessor instance this context is associated
39      * with.
40      * @return annotation processor instance
41      */

42     public AnnotationProcessor getProcessor();
43     
44     /**
45      * Returns the Scanner implementation which is responsible for providing
46      * access to all the .class files the processing tool needs to scan.
47      * @return scanner instance
48      */

49     public Scanner getProcessingInput();
50     
51     /**
52      * Sets the Scanner implementation which is responsible for accessing
53      * all the .class files the AnnotationProcessor should process.
54      */

55     public void setProcessingInput(Scanner scanner);
56     
57     /**
58      * Push a new handler on the stack of handlers. This handler will receive
59      * all the AnnotedElementHandler events until it is removed from the stack
60      * with a popHandler() call.
61      * @param handler the new events handler.
62      */

63     public void pushHandler(AnnotatedElementHandler handler);
64     
65     /**
66      * Return the current handler (if any) receving all the annotated elements
67      * start and stop events.
68      * @return the top handler
69      */

70     public AnnotatedElementHandler getHandler();
71         
72     /**
73      * Removes the top handler
74      * @return the removed handler
75      */

76     public AnnotatedElementHandler popHandler();
77     
78     /**
79      * Return the top handler casted to the requested handler type
80      * @param requested handler type
81      * @return the top handler
82      * @throws ClassCastException if the top handler cannot be casted to
83      * the requested handler type.
84      */

85     public <U extends AnnotatedElementHandler> U getHandler(Class JavaDoc<U> handlerType)
86         throws ClassCastException JavaDoc;
87
88     /**
89      * Sets the ErrorHandler instance for all errors/warnings that may be raised
90      * during the annotation processing.
91      * @param handler the annotation handler
92      */

93     public void setErrorHandler(ErrorHandler errorHandler);
94     
95     /**
96      * Return the error handler for this processing context.
97      * @return the error handler
98      */

99     public ErrorHandler getErrorHandler();
100             
101 }
102
Popular Tags