Package net.sourceforge.pmd.renderers
Class AbstractIncrementingRenderer
- java.lang.Object
-
- net.sourceforge.pmd.properties.AbstractPropertySource
-
- net.sourceforge.pmd.renderers.AbstractRenderer
-
- net.sourceforge.pmd.renderers.AbstractIncrementingRenderer
-
- All Implemented Interfaces:
PropertySource
,Renderer
- Direct Known Subclasses:
CodeClimateRenderer
,CSVRenderer
,EmacsRenderer
,HTMLRenderer
,IDEAJRenderer
,JsonRenderer
,SarifRenderer
,TextPadRenderer
,TextRenderer
,VBHTMLRenderer
,XMLRenderer
public abstract class AbstractIncrementingRenderer extends AbstractRenderer
Abstract base class forRenderer
implementations which can produce output incrementally forRuleViolation
s as source files are processed. SuchRenderer
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 theRenderer
, 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 theend()
method.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<Report.ConfigurationError>
configErrors
Accumulated configuration errors.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, inputPathPrefixes, name, showSuppressedViolations, writer
-
Fields inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
propertyDescriptors, propertyValuesByDescriptor
-
-
Constructor Summary
Constructors Constructor Description AbstractIncrementingRenderer(String name, String description)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
end()
This method is at the very end of the Rendering process, afterRenderer.renderFileReport(Report)
.void
renderFileReport(Report report)
Render the given file Report.abstract void
renderFileViolations(Iterator<RuleViolation> violations)
Render a series ofRuleViolation
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
determineFileName, flush, getDescription, getName, getPropertySourceType, getWriter, isShowSuppressedViolations, setDescription, setName, setReportFile, setShowSuppressedViolations, setUseShortNames, setWriter
-
Methods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, 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.properties.PropertySource
definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
-
Methods inherited from interface net.sourceforge.pmd.renderers.Renderer
defaultFileExtension
-
-
-
-
Field Detail
-
errors
protected List<Report.ProcessingError> errors
Accumulated processing errors.
-
configErrors
protected List<Report.ConfigurationError> configErrors
Accumulated configuration errors.
-
suppressed
protected List<Report.SuppressedViolation> suppressed
Accumulated suppressed violations.
-
-
Method Detail
-
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
-
startFileAnalysis
public void startFileAnalysis(DataSource dataSource)
Description copied from interface:Renderer
This method is called each time a source file is processed. It is called afterRenderer.start()
, but beforeRenderer.renderFileReport(Report)
andRenderer.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
Description copied from interface:Renderer
Render the given file Report. There may be multiple Report instances which need to be rendered if produced by different threads. It is called afterRenderer.start()
andRenderer.startFileAnalysis(DataSource)
, but beforeRenderer.end()
.- Parameters:
report
- A file Report.- Throws:
IOException
- See Also:
Report
-
renderFileViolations
public abstract void renderFileViolations(Iterator<RuleViolation> violations) throws IOException
Render a series ofRuleViolation
s.- Parameters:
violations
- The iterator of violations to render.- Throws:
IOException
-
end
public void end() throws IOException
Description copied from interface:Renderer
This method is at the very end of the Rendering process, afterRenderer.renderFileReport(Report)
.- Throws:
IOException
-
-