Package net.sourceforge.pmd.renderers
Class AbstractAccumulatingRenderer
- java.lang.Object
-
- net.sourceforge.pmd.properties.AbstractPropertySource
-
- net.sourceforge.pmd.renderers.AbstractRenderer
-
- net.sourceforge.pmd.renderers.AbstractAccumulatingRenderer
-
- All Implemented Interfaces:
PropertySource
,Renderer
- Direct Known Subclasses:
SummaryHTMLRenderer
,TextColorRenderer
,YAHTMLRenderer
public abstract class AbstractAccumulatingRenderer extends AbstractRenderer
Abstract base class forRenderer
implementations which only produce output once all source files are processed. SuchRenderer
s use working memory proportional to the number of violations found, which can be quite large in some scenarios. Consider usingAbstractIncrementingRenderer
which can use significantly less memory.Subclasses should only implement the
end()
method to output the complete#report
.- See Also:
AbstractIncrementingRenderer
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.renderers.AbstractRenderer
description, name, showSuppressedViolations, writer
-
Fields inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
propertyDescriptors, propertyValuesByDescriptor
-
-
Constructor Summary
Constructors Constructor Description AbstractAccumulatingRenderer(String name, String description)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
end()
This method is at the very end of the Rendering process, afterRenderer.renderFileReport(Report)
.GlobalAnalysisListener
newListener()
Returns a new analysis listener, that handles violations by rendering them in an implementation-defined way.protected abstract void
outputReport(Report report)
Output the report, called once at the end of the analysis.void
renderFileReport(Report report)
Deprecated.This is internal API.void
start()
This method is called before any source files are processed.void
startFileAnalysis(TextFile 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, setFileNameRenderer, setName, setReportFile, setShowSuppressedViolations, setWriter
-
Methods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, equals, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, hashCode, isPropertyOverridden, setProperty
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.properties.PropertySource
definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setProperty
-
Methods inherited from interface net.sourceforge.pmd.renderers.Renderer
defaultFileExtension
-
-
-
-
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
-
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
-
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 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
@InternalApi @Deprecated public final void renderFileReport(Report report) throws IOException
Deprecated.This is internal API. Do not override when extendingAbstractAccumulatingRenderer
. In PMD7 this method will be made final.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(TextFile)
, but beforeRenderer.end()
.- Parameters:
report
- A file Report.- Throws:
IOException
- See Also:
Report
-
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
-
-