-
public interface MessagerMessager为注释处理器提供了报告错误消息,警告和其他通知的方法。 可以传递元素,注释和注释值以提供消息的位置提示。 但是,此类位置提示可能不可用或仅是近似值。使用error kind打印消息将为raise an error 。
请注意,此界面中的方法“打印”的消息可能会或可能不会显示为
System.out或System.err等位置的文本输出。 实现可以选择以不同的方式呈现该信息,例如窗口中的消息。- 从以下版本开始:
- 1.6
- 另请参见:
-
ProcessingEnvironment.getLocale()
-
-
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 voidprintMessage(Diagnostic.Kind kind, CharSequence msg)打印指定类型的消息。voidprintMessage(Diagnostic.Kind kind, CharSequence msg, Element e)在元素的位置打印指定种类的消息。voidprintMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a)在带注释元素的注释镜像的位置打印指定类型的消息。voidprintMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a, AnnotationValue v)在注释元素的注释镜像内的注释值的位置处打印指定类型的消息。
-
-
-
方法详细信息
-
printMessage
void printMessage(Diagnostic.Kind kind, CharSequence msg)
打印指定类型的消息。- 参数
-
kind- 那种消息 -
msg- 消息,如果没有,则为空字符串
-
printMessage
void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e)
在元素的位置打印指定种类的消息。- 参数
-
kind- 那种消息 -
msg- 消息,如果没有,则为空字符串 -
e- 用作位置提示的元素
-
printMessage
void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a)
在带注释元素的注释镜像的位置打印指定类型的消息。- 参数
-
kind- 那种消息 -
msg- 消息,如果没有,则为空字符串 -
e- 带注释的元素 -
a- 用作位置提示的注释
-
printMessage
void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a, AnnotationValue v)
在注释元素的注释镜像内的注释值的位置处打印指定类型的消息。- 参数
-
kind- 那种消息 -
msg- 消息,如果没有,则为空字符串 -
e- 带注释的元素 -
a- 包含注释值的注释 -
v- the annotation value to use as a position hint
-
-