com.sun.tools.javac.api
Interface DiagnosticFormatter<D extends Diagnostic<?>>

Type Parameters:
D - type of diagnostic handled by this formatter
All Known Implementing Classes:
AbstractDiagnosticFormatter, BasicDiagnosticFormatter, RawDiagnosticFormatter

public interface DiagnosticFormatter<D extends Diagnostic<?>>

Provides simple functionalities for javac diagnostic formatting


Nested Class Summary
static class DiagnosticFormatter.PositionKind
          This enum defines a set of constants for all the kinds of position that a diagnostic can be asked for.
 
Method Summary
 boolean displaySource(D diag)
          Whether the source code output for this diagnostic is to be displayed
 java.lang.String format(D diag, java.util.Locale l)
          Format the contents of a diagnostics
 java.lang.String formatKind(D diag, java.util.Locale l)
          Controls the way in which a diagnostic kind is displayed.
 java.lang.String formatMessage(D diag, java.util.Locale l)
          Controls the way in which a diagnostic message is displayed.
 java.lang.String formatPosition(D diag, DiagnosticFormatter.PositionKind pk, java.util.Locale l)
          Controls the way in which a diagnostic position is displayed.
 java.lang.String formatSource(D diag, boolean fullname, java.util.Locale l)
          Controls the way in which a diagnostic source is displayed.
 

Method Detail

displaySource

boolean displaySource(D diag)
Whether the source code output for this diagnostic is to be displayed

Parameters:
diag - diagnostic to be formatted
Returns:
true if the source line this diagnostic refers to is to be displayed

format

java.lang.String format(D diag,
                        java.util.Locale l)
Format the contents of a diagnostics

Parameters:
diag - the diagnostic to be formatted
l - locale object to be used for i18n
Returns:
a string representing the diagnostic

formatMessage

java.lang.String formatMessage(D diag,
                               java.util.Locale l)
Controls the way in which a diagnostic message is displayed.

Parameters:
diag - diagnostic to be formatted
l - locale object to be used for i18n
Returns:
string representation of the diagnostic message

formatKind

java.lang.String formatKind(D diag,
                            java.util.Locale l)
Controls the way in which a diagnostic kind is displayed.

Parameters:
diag - diagnostic to be formatted
l - locale object to be used for i18n
Returns:
string representation of the diagnostic prefix

formatSource

java.lang.String formatSource(D diag,
                              boolean fullname,
                              java.util.Locale l)
Controls the way in which a diagnostic source is displayed.

Parameters:
diag - diagnostic to be formatted
l - locale object to be used for i18n
fullname - whether the source fullname should be printed
Returns:
string representation of the diagnostic source

formatPosition

java.lang.String formatPosition(D diag,
                                DiagnosticFormatter.PositionKind pk,
                                java.util.Locale l)
Controls the way in which a diagnostic position is displayed.

Parameters:
diag - diagnostic to be formatted
pk - enum constant representing the position kind
l - locale object to be used for i18n
Returns:
string representation of the diagnostic position