net.sourceforge.pmd.renderers

## Class AbstractIncrementingRenderer

- java.lang.Object
- - net.sourceforge.pmd.AbstractPropertySource
  - - net.sourceforge.pmd.renderers.AbstractRenderer
    - - net.sourceforge.pmd.renderers.AbstractIncrementingRenderer

All Implemented Interfaces:
  PropertySource, Renderer

Direct Known Subclasses:
  CSVRenderer, EmacsRenderer, HTMLRenderer, IDEAJRenderer, TextPadRenderer, TextRenderer, VBHTMLRenderer, XMLRenderer

    public abstract class AbstractIncrementingRenderer
    extends AbstractRenderer

Abstract base class for `Renderer` implementations which can produce output incrementally for `RuleViolation`s as source files are processed. Such `Renderer`s are able to produce large reports with significantly less working memory at any given time. Variations in the delivery of source file reports are reflected in the output of the `Renderer`, so report output can be different between runs. Only processing errors and suppressed violations are accumulated across all files. These are intended to be processed in the `end()` method.

### Field Summary

Fields
`protected List<Report.ProcessingError>` `errors` Accumulated processing errors.
`protected List<Report.SuppressedViolation>` `suppressed` Accumulated suppressed violations.

### Fields inherited from class net.sourceforge.pmd.renderers.AbstractRenderer

`description, name, propertyDefinitions, showSuppressedViolations, writer`

### Fields inherited from class net.sourceforge.pmd.AbstractPropertySource

`propertyDescriptors, propertyValuesByDescriptor`

### Constructor Summary

Constructors
Constructor and Description
`AbstractIncrementingRenderer(String name, String description)`

### Method Summary

Methods
`void` `end()` This method is at the very end of the Rendering process, after `Renderer.renderFileReport(Report)`.
`void` `renderFileReport(Report report)` Render the given file Report.
`abstract void` `renderFileViolations(Iterator<RuleViolation> violations)` Render a series of `RuleViolation`s.
`void` `start()` This method is called before any source files are processed.
`void` `startFileAnalysis(DataSource dataSource)` This method is called each time a source file is processed.

### Methods inherited from class net.sourceforge.pmd.renderers.AbstractRenderer

`defineProperty, flush, getDescription, getName, getPropertyDefinitions, getWriter, isShowSuppressedViolations, setDescription, setName, setShowSuppressedViolations, setWriter`

### Methods inherited from class net.sourceforge.pmd.AbstractPropertySource

`copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.sourceforge.pmd.renderers.Renderer

`defaultFileExtension`

### Methods inherited from interface net.sourceforge.pmd.PropertySource

`definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues`

### Field Detail

#### errors

    protected List<Report.ProcessingError> errors

Accumulated processing errors.

#### suppressed

    protected List<Report.SuppressedViolation> suppressed

Accumulated suppressed violations.

### Constructor Detail

#### AbstractIncrementingRenderer

    public AbstractIncrementingRenderer(String name,
                                String description)

### Method Detail

#### start

    public void start()
               throws IOException

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`

#### startFileAnalysis

    public void startFileAnalysis(DataSource dataSource)

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 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(DataSource)`, but before `Renderer.end()`.

Parameters:
  `report` - A file Report.
Throws:
  `IOException`
See Also:
  `Report`

#### renderFileViolations

    public abstract void renderFileViolations(Iterator<RuleViolation> violations)
                                       throws IOException

Render a series of `RuleViolation`s.

Parameters:
  `violations` - The iterator of violations to render.
Throws:
  `IOException`

#### end

    public void end()
             throws IOException

This method is at the very end of the Rendering process, after `Renderer.renderFileReport(Report)`.

Throws:
  `IOException`