Class ReportWriter
- java.lang.Object
-
- org.jboss.logging.processor.apt.report.ReportWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
AsciidocReportWriter
,XmlReportWriter
public abstract class ReportWriter extends java.lang.Object implements java.io.Closeable
Writes reports based on aMessageInterface
. These reports could be used for documented messages from logging or message bundle interfaces.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
baseUrl
(package private) static java.lang.String
DEFAULT_ID
(package private) java.lang.String
messageIdFormat
(package private) MessageInterface
messageInterface
-
Constructor Summary
Constructors Constructor Description ReportWriter(MessageInterface messageInterface)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) java.lang.String
getLogLevel(MessageMethod method)
Gets the log level from the@Message
annotation.(package private) abstract ReportType
getReportType()
The report type for this writer.private ResolutionDoc
getResolutionDoc(MessageMethod messageMethod)
(package private) java.lang.String
getUrl(MessageMethod messageMethod, java.lang.String id)
static ReportWriter
of(ReportType reportType, MessageInterface messageInterface, java.io.BufferedWriter writer)
Creates a new report writer based on the report type.abstract void
writeDetail(MessageMethod messageMethod)
Writes a detail line for the report.abstract void
writeFooter()
Writes the footer for the report.abstract void
writeHeader(java.lang.String title)
Writes the header for the report.
-
-
-
Field Detail
-
DEFAULT_ID
static final java.lang.String DEFAULT_ID
- See Also:
- Constant Field Values
-
baseUrl
private final java.lang.String baseUrl
-
messageInterface
final MessageInterface messageInterface
-
messageIdFormat
final java.lang.String messageIdFormat
-
-
Constructor Detail
-
ReportWriter
ReportWriter(MessageInterface messageInterface)
-
-
Method Detail
-
of
public static ReportWriter of(ReportType reportType, MessageInterface messageInterface, java.io.BufferedWriter writer)
Creates a new report writer based on the report type.- Parameters:
reportType
- the report type to create the writer forwriter
- the used to write the contents to- Returns:
- the report writer to use
- Throws:
java.lang.IllegalStateException
- if there was an error creating the report writerjava.lang.IllegalArgumentException
- if thereportType
is invalid
-
writeHeader
public abstract void writeHeader(java.lang.String title) throws java.io.IOException
Writes the header for the report.- Parameters:
title
- the title of the header- Throws:
java.io.IOException
- if an I/O error occurs
-
writeDetail
public abstract void writeDetail(MessageMethod messageMethod) throws java.io.IOException
Writes a detail line for the report.- Parameters:
messageMethod
- the method to write the details for- Throws:
java.io.IOException
- if an I/O error occurs
-
writeFooter
public abstract void writeFooter() throws java.io.IOException
Writes the footer for the report.- Throws:
java.io.IOException
- if an I/O error occurs
-
getReportType
abstract ReportType getReportType()
The report type for this writer.- Returns:
- the report type
-
getLogLevel
java.lang.String getLogLevel(MessageMethod method)
Gets the log level from the@Message
annotation.- Parameters:
method
- the method to get the log level from- Returns:
- the log level or an empty string
-
getUrl
java.lang.String getUrl(MessageMethod messageMethod, java.lang.String id)
-
getResolutionDoc
private ResolutionDoc getResolutionDoc(MessageMethod messageMethod)
-
-