KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > annotation > processing > Messager


1 /*
2  * @(#)Messager.java 1.7 06/08/28
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.annotation.processing;
9
10 import javax.annotation.*;
11 import javax.tools.Diagnostic;
12 import javax.lang.model.element.*;
13
14 /**
15  * A {@code Messager} provides the way for an annotation processor to
16  * report error messages, warnings, and other notices. Elements,
17  * annotations, and annotation values can be passed to provide a
18  * location hint for the message. However, such location hints may be
19  * unavailable or only approximate.
20  *
21  * <p>Printing a message with an {@linkplain
22  * javax.tools.Diagnostic.Kind#ERROR error kind} will {@linkplain
23  * RoundEnvironment#errorRaised raise an error}.
24  *
25  * <p>Note that the messages &quot;printed&quot; by methods in this
26  * interface may or may not appear as textual output to a location
27  * like {@link System#out} or {@link System#err}. Implementations may
28  * choose to present this information in a different fashion, such as
29  * messages in a window.
30  *
31  * @author Joseph D. Darcy
32  * @author Scott Seligman
33  * @author Peter von der Ah&eacute;
34  * @version 1.7 06/08/28
35  * @see ProcessingEnvironment#getLocale
36  * @since 1.6
37  */

38 public interface Messager {
39     /**
40      * Prints a message of the specified kind.
41      *
42      * @param kind the kind of message
43      * @param msg the message, or an empty string if none
44      */

45     void printMessage(Diagnostic.Kind kind, CharSequence JavaDoc msg);
46
47     /**
48      * Prints a message of the specified kind at the location of the
49      * element.
50      *
51      * @param kind the kind of message
52      * @param msg the message, or an empty string if none
53      * @param e the element to use as a position hint
54      */

55     void printMessage(Diagnostic.Kind kind, CharSequence JavaDoc msg, Element e);
56
57     /**
58      * Prints a message of the specified kind at the location of the
59      * annotation mirror of the annotated element.
60      *
61      * @param kind the kind of message
62      * @param msg the message, or an empty string if none
63      * @param e the annotated element
64      * @param a the annotation to use as a position hint
65      */

66     void printMessage(Diagnostic.Kind kind, CharSequence JavaDoc msg, Element e, AnnotationMirror a);
67
68     /**
69      * Prints a message of the specified kind at the location of the
70      * annotation value inside the annotation mirror of the annotated
71      * element.
72      *
73      * @param kind the kind of message
74      * @param msg the message, or an empty string if none
75      * @param e the annotated element
76      * @param a the annotation containing the annotation value
77      * @param v the annotation value to use as a position hint
78      */

79     void printMessage(Diagnostic.Kind kind,
80               CharSequence JavaDoc msg,
81               Element e,
82               AnnotationMirror a,
83               AnnotationValue v);
84 }
85
Popular Tags