public interface Messager
Messager
提供注释处理器报告错误信息,这样的警告,以及其他注意事项。元素、注释和注释值可以传递给消息提供位置提示。然而,这样的位置提示可能是不可用的或只有近似。
一个error kind打印一条消息将raise an error。
请注意,“印刷”的消息在这个接口的方法可能出现的文本输出到一个位置,像System.out
或System.err
不得。实现可以选择以不同的方式呈现这些信息,如在一个窗口消息。
ProcessingEnvironment.getLocale()
Modifier and Type | Method and Description |
---|---|
void |
printMessage(Diagnostic.Kind kind, CharSequence msg)
打印指定类型的消息。
|
void |
printMessage(Diagnostic.Kind kind, CharSequence msg, Element e)
在元素的位置上打印指定类型的消息。
|
void |
printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a)
在注释元素的注释镜像的位置上打印指定类型的消息。
|
void |
printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a, AnnotationValue v)
在注释元素的注释镜像中的注释值的位置上打印指定类型的消息。
|
void printMessage(Diagnostic.Kind kind, CharSequence msg)
kind
-一种信息
msg
的消息,或空字符串,如果没有
void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e)
kind
-一种信息
msg
的消息,或空字符串,如果没有
e
-元件作为位置提示
void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a)
kind
-一种信息
msg
的消息,或空字符串,如果没有
e
-注释的元素
a
-注释作为位置提示
void printMessage(Diagnostic.Kind kind, CharSequence msg, Element e, AnnotationMirror a, AnnotationValue v)
kind
-一种信息
msg
的消息,或空字符串,如果没有
e
-注释的元素
a
含有注释的价值诠释
v
-使用一个位置提示诠释价值
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.