Package net.sourceforge.pmd.renderers
Interface Renderer
-
- All Superinterfaces:
PropertySource
- All Known Implementing Classes:
AbstractAccumulatingRenderer,AbstractIncrementingRenderer,AbstractRenderer,CodeClimateRenderer,CSVRenderer,EmacsRenderer,EmptyRenderer,HTMLRenderer,IDEAJRenderer,SummaryHTMLRenderer,TextColorRenderer,TextPadRenderer,TextRenderer,VBHTMLRenderer,XMLRenderer,XSLTRenderer,YAHTMLRenderer
public interface Renderer extends PropertySource
This is an interface for rendering a Report. When a Renderer is being invoked, the sequence of method calls is something like the following:- Renderer construction/initialization
setShowSuppressedViolations(boolean)setUseShortNames(List)setWriter(Writer)start()startFileAnalysis(DataSource)for each source file processedrenderFileReport(Report)for each Report instanceend()
An implementation of the Renderer interface is expected to have a default constructor. Properties should be defined using the
PropertySource.definePropertyDescriptor(PropertyDescriptor)method. After the instance is created, the property values are set. This means, you won't have access to property values in your constructor.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringdefaultFileExtension()Return the default filename extension to use.voidend()This method is at the very end of the Rendering process, afterrenderFileReport(Report).voidflush()java.lang.StringgetDescription()Get the description of the Renderer.java.lang.StringgetName()Get the name of the Renderer.java.io.WritergetWriter()Get the Writer for the Renderer.booleanisShowSuppressedViolations()Get the indicator for whether to show suppressed violations.voidrenderFileReport(Report report)Render the given file Report.voidsetDescription(java.lang.String description)Set the description of the Renderer.voidsetName(java.lang.String name)Set the name of the Renderer.voidsetShowSuppressedViolations(boolean showSuppressedViolations)Set the indicator for whether to show suppressed violations.voidsetUseShortNames(java.util.List<java.lang.String> inputPaths)Render the filenames of found violations with short names.voidsetWriter(java.io.Writer writer)Set the Writer for the Renderer.voidstart()This method is called before any source files are processed.voidstartFileAnalysis(DataSource dataSource)This method is called each time a source file is processed.-
Methods inherited from interface net.sourceforge.pmd.properties.PropertySource
definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
-
-
-
-
Method Detail
-
getName
java.lang.String getName()
Get the name of the Renderer.- Specified by:
getNamein interfacePropertySource- Returns:
- The name of the Renderer.
-
setName
void setName(java.lang.String name)
Set the name of the Renderer.- Parameters:
name- The name of the Renderer.
-
getDescription
java.lang.String getDescription()
Get the description of the Renderer.- Returns:
- The description of the Renderer.
-
defaultFileExtension
java.lang.String defaultFileExtension()
Return the default filename extension to use.- Returns:
- String
-
setDescription
void setDescription(java.lang.String description)
Set the description of the Renderer.- Parameters:
description- The description of the Renderer.
-
isShowSuppressedViolations
boolean isShowSuppressedViolations()
Get the indicator for whether to show suppressed violations.- Returns:
trueif suppressed violations should show,falseotherwise.
-
setShowSuppressedViolations
void setShowSuppressedViolations(boolean showSuppressedViolations)
Set the indicator for whether to show suppressed violations.- Parameters:
showSuppressedViolations- Whether to show suppressed violations.
-
setUseShortNames
void setUseShortNames(java.util.List<java.lang.String> inputPaths)
Render the filenames of found violations with short names. That is, any prefix given as inputPaths is removed. By default, the full pathnames are used. If the given list ofinputPathsis empty, then the full pathnames are used.- Parameters:
inputPaths-
-
getWriter
java.io.Writer getWriter()
Get the Writer for the Renderer.- Returns:
- The Writer.
-
setWriter
void setWriter(java.io.Writer writer)
Set the Writer for the Renderer.- Parameters:
writer- The Writer.
-
start
void start() throws java.io.IOExceptionThis 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:
java.io.IOException
-
startFileAnalysis
void startFileAnalysis(DataSource dataSource)
This method is called each time a source file is processed. It is called afterstart(), but beforerenderFileReport(Report)andend(). 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
void renderFileReport(Report report) throws java.io.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 afterstart()andstartFileAnalysis(DataSource), but beforeend().- Parameters:
report- A file Report.- Throws:
java.io.IOException- See Also:
Report
-
end
void end() throws java.io.IOException
This method is at the very end of the Rendering process, afterrenderFileReport(Report).- Throws:
java.io.IOException
-
flush
void flush() throws java.io.IOException- Throws:
java.io.IOException
-
-