public abstract class ReportWriter extends Object implements Closeable
MessageInterface. These reports could be used for documented messages from logging
or message bundle interfaces.| Modifier and Type | Field and Description |
|---|---|
protected BufferedWriter |
writer
The backing writer to use.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ReportWriter(BufferedWriter writer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected String |
getLogLevel(MessageMethod method)
Gets the log level from the
@Message annotation. |
protected Collection<MessageMethod> |
getSortedMessageMethods(MessageInterface messageInterface)
Returns a sorted collection of the message methods on the interface.
|
static ReportWriter |
of(ReportType reportType,
BufferedWriter writer)
Creates a new report writer based on the report type.
|
abstract void |
write(MessageInterface messageInterface)
Writes the message interface to the reports ouput.
|
void |
writeEnd()
Writes any ending information for the report.
|
void |
writeStart(Optional<String> title)
Writes a header for the report.
|
protected final BufferedWriter writer
protected ReportWriter(BufferedWriter writer)
public static ReportWriter of(ReportType reportType, BufferedWriter writer)
reportType - the report type to create the writer forwriter - the used to write the contents toIllegalStateException - if there was an error creating the report writerIllegalArgumentException - if the reportType is invalidpublic abstract void write(MessageInterface messageInterface) throws IOException
messageInterface - the message interface to writeIOException - if a write failure occurspublic void writeStart(Optional<String> title) throws IOException
title - the optional title for the reportIOException - if a write failure occurspublic void writeEnd()
throws IOException
IOException - if a write failure occurspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected String getLogLevel(MessageMethod method)
@Message annotation.method - the method to get the log level fromprotected Collection<MessageMethod> getSortedMessageMethods(MessageInterface messageInterface)
messageInterface - the message interface to get the methods forCopyright © 2016 JBoss by Red Hat. All rights reserved.