Class AbstractAccumulatingRenderer

All Implemented Interfaces:
PropertySource, Renderer
Direct Known Subclasses:
SummaryHTMLRenderer, TextColorRenderer, YAHTMLRenderer

public abstract class AbstractAccumulatingRenderer extends AbstractRenderer
Abstract base class for Renderer implementations which only produce output once all source files are processed. Such Renderers use working memory proportional to the number of violations found, which can be quite large in some scenarios. Consider using AbstractIncrementingRenderer which can use significantly less memory.

Subclasses should only implement the outputReport(Report) method to output the complete Report in the end.

See Also:
  • Constructor Details

    • AbstractAccumulatingRenderer

      public AbstractAccumulatingRenderer(String name, String description)
  • Method Details

    • start

      public void start() throws IOException
      Description copied from interface: Renderer
      This method is called before any source files are processed. The Renderer will have been fully initialized by the time this method is called, so the Writer and other state will be available.
      Throws:
      IOException
    • end

      public void end() throws IOException
      Description copied from interface: Renderer
      This method is at the very end of the Rendering process, after Renderer.renderFileReport(Report).
      Throws:
      IOException
    • startFileAnalysis

      public void startFileAnalysis(TextFile dataSource)
      Description copied from interface: Renderer
      This method is called each time a source file is processed. It is called after Renderer.start(), but before Renderer.renderFileReport(Report) and Renderer.end(). This method may be invoked by different threads which are processing files independently. Therefore, any non-trivial implementation of this method needs to be thread-safe.
      Parameters:
      dataSource - The source file.
    • renderFileReport

      public final void renderFileReport(Report report) throws IOException
      Render the given file Report. There may be multiple Report instances which need to be rendered if produced by different threads. It is called after Renderer.start() and Renderer.startFileAnalysis(TextFile), but before Renderer.end().
      Implementation Note:
      The implementation in this class does nothing. All the reported violations and errors are accumulated and can be rendered once with outputReport(Report) in the end. Subclasses of AbstractAccumulatingRenderer cannot override this method anymore.
      Parameters:
      report - A file Report.
      Throws:
      IOException
      See Also:
    • outputReport

      protected abstract void outputReport(Report report) throws IOException
      Output the report, called once at the end of the analysis.
      Throws:
      IOException
    • newListener

      public GlobalAnalysisListener newListener() throws IOException
      Description copied from interface: Renderer
      Returns a new analysis listener, that handles violations by rendering them in an implementation-defined way.
      Throws:
      IOException