KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
27  * Exception that denotes a warning or error condition in the
28  * annotation procesing tool
29  *
30  * @author Jerome Dochez
31  */

32 public class AnnotationProcessorException extends Exception JavaDoc {
33     
34     final private String JavaDoc message;
35     
36     final private AnnotationInfo locator;
37     
38     boolean isFatal = false;
39     
40     /**
41      * Creats a new annotation exception
42      * @param message describing the exception cause
43      */

44     public AnnotationProcessorException(String JavaDoc message) {
45         this.message = message;
46         this.locator = null;
47     }
48     
49     /**
50      * Creates a new annotation exception
51      * @param message describing the exception cause
52      * @param locator gives information about the annotation and
53      * the annotated element which caused the exception
54      */

55     public AnnotationProcessorException(String JavaDoc message, AnnotationInfo locator) {
56         this.message = message;
57         this.locator = locator;
58     }
59     
60     /**
61      * Return a meaningful string explaining the exception cause
62      * @return the exception reason
63      */

64     public String JavaDoc getMessage() {
65         return message;
66     }
67     
68     /**
69      * Return information about the annotation and annotated element
70      * which caused the exception or null if it is not available.
71      * @return the annotation info instance
72      */

73     public AnnotationInfo getLocator() {
74         return locator;
75     }
76     
77     /**
78      * @return a meaningful description
79      */

80     public String JavaDoc toString() {
81         return (locator==null?message:message + "at " + locator);
82     }
83     
84     /**
85      *
86      * @return true if this exception was considered by the sender as being
87      * fatal to the annotations processing(i.e. it should stop).
88      */

89     public boolean isFatal(){
90         return isFatal;
91     }
92    
93     /**
94      * Sets wether is exception is considered as fatal to the annotation
95      * processing.
96      * @param true if the annotation processing should stop
97      */

98      public void setFatal(boolean fatal){
99          this.isFatal = fatal;
100      }
101 }
102
Popular Tags