|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tools.javac.util.AbstractDiagnosticFormatter
public abstract class AbstractDiagnosticFormatter
This abstract class provides a basic implementation of the functionalities that should be provided by any formatter used by javac. Among the main features provided by AbstractDiagnosticFormatter are:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.sun.tools.javac.api.DiagnosticFormatter |
|---|
DiagnosticFormatter.PositionKind |
| Field Summary | |
|---|---|
protected JavacMessages |
messages
JavacMessages object used by this formatter for i18n |
protected boolean |
showSource
|
| Constructor Summary | |
|---|---|
protected |
AbstractDiagnosticFormatter(JavacMessages messages,
boolean showSource)
|
protected |
AbstractDiagnosticFormatter(JavacMessages messages,
Options options,
boolean showSource)
Initialize an AbstractDiagnosticFormatter by setting its JavacMessages object |
| Method Summary | |
|---|---|
boolean |
displaySource(JCDiagnostic d)
Whether the source code output for this diagnostic is to be displayed |
protected java.lang.String |
formatArgument(JCDiagnostic d,
java.lang.Object arg,
java.util.Locale l)
Format a single argument of a given diagnostic. |
protected java.util.Collection<java.lang.String> |
formatArguments(JCDiagnostic d,
java.util.Locale l)
Format the arguments of a given diagnostic. |
protected java.lang.String |
formatIterable(JCDiagnostic d,
java.lang.Iterable<?> it,
java.util.Locale l)
Format an iterable argument of a given diagnostic. |
java.lang.String |
formatKind(JCDiagnostic d,
java.util.Locale l)
Controls the way in which a diagnostic kind is displayed. |
java.lang.String |
formatMessage(JCDiagnostic d,
java.util.Locale l)
Controls the way in which a diagnostic message is displayed. |
java.lang.String |
formatPosition(JCDiagnostic d,
DiagnosticFormatter.PositionKind pk,
java.util.Locale l)
Controls the way in which a diagnostic position is displayed. |
java.lang.String |
formatSource(JCDiagnostic d,
boolean fullname,
java.util.Locale l)
Controls the way in which a diagnostic source is displayed. |
protected java.lang.String |
formatSourceLine(JCDiagnostic d)
Format the faulty source code line and point to the error. |
protected java.lang.String |
formatSubdiagnostics(JCDiagnostic d,
java.util.Locale l)
Format all the subdiagnostics attached to a given diagnostic |
long |
getPosition(JCDiagnostic d,
DiagnosticFormatter.PositionKind pk)
|
protected java.lang.String |
indent(java.lang.String s,
int nSpaces)
Indent a string by prepending a given amount of empty spaces to each line of the string |
protected java.lang.String |
indentString(int nSpaces)
Creates a string with a given amount of empty spaces. |
protected java.lang.String |
localize(java.util.Locale l,
java.lang.String key,
java.lang.Object... args)
Converts a String into a locale-dependent representation accordingly to a given locale |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.tools.javac.api.DiagnosticFormatter |
|---|
format |
| Field Detail |
|---|
protected JavacMessages messages
protected boolean showSource
| Constructor Detail |
|---|
protected AbstractDiagnosticFormatter(JavacMessages messages, Options options, boolean showSource)
messages - protected AbstractDiagnosticFormatter(JavacMessages messages, boolean showSource)
| Method Detail |
|---|
public java.lang.String formatMessage(JCDiagnostic d, java.util.Locale l)
DiagnosticFormatter
formatMessage in interface DiagnosticFormatter<JCDiagnostic>d - diagnostic to be formattedl - locale object to be used for i18n
public java.lang.String formatKind(JCDiagnostic d, java.util.Locale l)
DiagnosticFormatter
formatKind in interface DiagnosticFormatter<JCDiagnostic>d - diagnostic to be formattedl - locale object to be used for i18n
public java.lang.String formatPosition(JCDiagnostic d, DiagnosticFormatter.PositionKind pk, java.util.Locale l)
DiagnosticFormatter
formatPosition in interface DiagnosticFormatter<JCDiagnostic>d - diagnostic to be formattedpk - enum constant representing the position kindl - locale object to be used for i18n
public long getPosition(JCDiagnostic d, DiagnosticFormatter.PositionKind pk)
public java.lang.String formatSource(JCDiagnostic d, boolean fullname, java.util.Locale l)
DiagnosticFormatter
formatSource in interface DiagnosticFormatter<JCDiagnostic>d - diagnostic to be formattedfullname - whether the source fullname should be printedl - locale object to be used for i18n
protected java.util.Collection<java.lang.String> formatArguments(JCDiagnostic d, java.util.Locale l)
d - diagnostic whose arguments are to be formattedl - locale object to be used for i18n
protected java.lang.String formatArgument(JCDiagnostic d, java.lang.Object arg, java.util.Locale l)
d - diagnostic whose argument is to be formattedarg - argument to be formattedl - locale object to be used for i18n
protected java.lang.String formatIterable(JCDiagnostic d, java.lang.Iterable<?> it, java.util.Locale l)
d - diagnostic whose argument is to be formattedit - iterable argument to be formattedl - locale object to be used for i18n
protected java.lang.String formatSubdiagnostics(JCDiagnostic d, java.util.Locale l)
d - diagnostic whose subdiagnostics are to be formattedl - locale object to be used for i18n
protected java.lang.String formatSourceLine(JCDiagnostic d)
d - The diagnostic for which the error line should be printedprotected java.lang.String localize(java.util.Locale l, java.lang.String key, java.lang.Object... args)
l - locale object to be used for i18nkey - locale-independent key used for looking up in a resource fileargs - localization arguments
public boolean displaySource(JCDiagnostic d)
DiagnosticFormatter
displaySource in interface DiagnosticFormatter<JCDiagnostic>d - diagnostic to be formatted
protected java.lang.String indentString(int nSpaces)
nSpaces - the amount of spaces to be added to the result string
protected java.lang.String indent(java.lang.String s, int nSpaces)
s - the string to be indentednSpaces - the amount of spaces that should be prepended to each line
of the string
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||