Class ReportWriter

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public abstract class ReportWriter
    extends java.lang.Object
    implements java.io.Closeable
    Writes reports based on a MessageInterface. These reports could be used for documented messages from logging or message bundle interfaces.
    Author:
    James R. Perkins
    • 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 for
        writer - 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 writer
        java.lang.IllegalArgumentException - if the reportType 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