com.sun.tools.javac.util
Class RawDiagnosticFormatter

java.lang.Object
  extended by com.sun.tools.javac.util.AbstractDiagnosticFormatter
      extended by com.sun.tools.javac.util.RawDiagnosticFormatter
All Implemented Interfaces:
DiagnosticFormatter<JCDiagnostic>

public class RawDiagnosticFormatter
extends AbstractDiagnosticFormatter

A raw formatter for diagnostic messages. The raw formatter will format a diagnostic according to one of two format patterns, depending on whether or not the source name and position are set. This formatter provides a standardized, localize-independent implementation of a diagnostic formatter; as such, this formatter is best suited for testing purposes.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.tools.javac.api.DiagnosticFormatter
DiagnosticFormatter.PositionKind
 
Field Summary
 
Fields inherited from class com.sun.tools.javac.util.AbstractDiagnosticFormatter
messages, showSource
 
Constructor Summary
RawDiagnosticFormatter(Options opts)
          Create a formatter based on the supplied options.
 
Method Summary
 java.lang.String format(JCDiagnostic d, java.util.Locale l)
          Format the contents of a diagnostics
protected  java.lang.String formatArgument(JCDiagnostic diag, java.lang.Object arg, java.util.Locale l)
          Format a single argument of a given diagnostic.
protected  java.lang.String formatSubdiagnostics(JCDiagnostic d, java.util.Locale l)
          Format all the subdiagnostics attached to a given diagnostic
protected  java.lang.String localize(java.util.Locale l, java.lang.String s, java.lang.Object... args)
          Converts a String into a locale-dependent representation accordingly to a given locale
 
Methods inherited from class com.sun.tools.javac.util.AbstractDiagnosticFormatter
displaySource, formatArguments, formatIterable, formatKind, formatMessage, formatPosition, formatSource, formatSourceLine, getPosition, indent, indentString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawDiagnosticFormatter

public RawDiagnosticFormatter(Options opts)
Create a formatter based on the supplied options.

Parameters:
msgs -
Method Detail

format

public java.lang.String format(JCDiagnostic d,
                               java.util.Locale l)
Description copied from interface: DiagnosticFormatter
Format the contents of a diagnostics

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

formatArgument

protected java.lang.String formatArgument(JCDiagnostic diag,
                                          java.lang.Object arg,
                                          java.util.Locale l)
Description copied from class: AbstractDiagnosticFormatter
Format a single argument of a given diagnostic.

Overrides:
formatArgument in class AbstractDiagnosticFormatter
Parameters:
diag - diagnostic whose argument is to be formatted
arg - argument to be formatted
l - locale object to be used for i18n
Returns:
string representation of the diagnostic argument

formatSubdiagnostics

protected java.lang.String formatSubdiagnostics(JCDiagnostic d,
                                                java.util.Locale l)
Description copied from class: AbstractDiagnosticFormatter
Format all the subdiagnostics attached to a given diagnostic

Overrides:
formatSubdiagnostics in class AbstractDiagnosticFormatter
Parameters:
d - diagnostic whose subdiagnostics are to be formatted
l - locale object to be used for i18n
Returns:
string representation of the subdiagnostics

localize

protected java.lang.String localize(java.util.Locale l,
                                    java.lang.String s,
                                    java.lang.Object... args)
Description copied from class: AbstractDiagnosticFormatter
Converts a String into a locale-dependent representation accordingly to a given locale

Overrides:
localize in class AbstractDiagnosticFormatter
Parameters:
l - locale object to be used for i18n
s - locale-independent key used for looking up in a resource file
args - localization arguments
Returns:
a locale-dependent string