Package net.sourceforge.pmd.renderers
Class AbstractRenderer
java.lang.Object
net.sourceforge.pmd.properties.AbstractPropertySource
net.sourceforge.pmd.renderers.AbstractRenderer
- All Implemented Interfaces:
PropertySource,Renderer
- Direct Known Subclasses:
AbstractAccumulatingRenderer,AbstractIncrementingRenderer,EmptyRenderer
Abstract base class for
Renderer implementations.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected booleanprotected PrintWriter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final StringdetermineFileName(FileId fileId) Determines the filename that should be used in the report for the given ID.voidflush()Get the description of the Renderer.getName()Get the name of the Renderer.protected StringGet the Writer for the Renderer.booleanGet the indicator for whether to show suppressed violations.voidsetDescription(String description) Set the description of the Renderer.voidsetFileNameRenderer(FileNameRenderer fileNameRenderer) Set theFileNameRendererused to render file paths to the report.voidSet the name of the Renderer.voidsetReportFile(String reportFilename) Sets the filename where the report should be written to.voidsetShowSuppressedViolations(boolean showSuppressedViolations) Set the indicator for whether to show suppressed violations.voidSet the Writer for the Renderer.Methods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
definePropertyDescriptor, equals, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, hashCode, isPropertyOverridden, setPropertyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sourceforge.pmd.properties.PropertySource
definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setPropertyMethods inherited from interface net.sourceforge.pmd.renderers.Renderer
defaultFileExtension, end, newListener, renderFileReport, start, startFileAnalysis
-
Field Details
-
name
-
description
-
showSuppressedViolations
protected boolean showSuppressedViolations -
writer
-
-
Constructor Details
-
AbstractRenderer
-
-
Method Details
-
getPropertySourceType
- Specified by:
getPropertySourceTypein classAbstractPropertySource
-
getName
Description copied from interface:RendererGet the name of the Renderer.- Specified by:
getNamein interfacePropertySource- Specified by:
getNamein interfaceRenderer- Returns:
- The name of the Renderer.
-
setName
Description copied from interface:RendererSet the name of the Renderer. -
getDescription
Description copied from interface:RendererGet the description of the Renderer.- Specified by:
getDescriptionin interfaceRenderer- Returns:
- The description of the Renderer.
-
setDescription
Description copied from interface:RendererSet the description of the Renderer.- Specified by:
setDescriptionin interfaceRenderer- Parameters:
description- The description of the Renderer.
-
isShowSuppressedViolations
public boolean isShowSuppressedViolations()Description copied from interface:RendererGet the indicator for whether to show suppressed violations.- Specified by:
isShowSuppressedViolationsin interfaceRenderer- Returns:
trueif suppressed violations should show,falseotherwise.
-
setShowSuppressedViolations
public void setShowSuppressedViolations(boolean showSuppressedViolations) Description copied from interface:RendererSet the indicator for whether to show suppressed violations.- Specified by:
setShowSuppressedViolationsin interfaceRenderer- Parameters:
showSuppressedViolations- Whether to show suppressed violations.
-
setFileNameRenderer
Description copied from interface:RendererSet theFileNameRendererused to render file paths to the report. Note that this renderer does not have to use the parameter to output paths. Some report formats require a specific format for paths (eg a URI), and are allowed to circumvent the provided strategy.- Specified by:
setFileNameRendererin interfaceRenderer- Parameters:
fileNameRenderer- a non-null file name renderer
-
determineFileName
Determines the filename that should be used in the report for the given ID. This uses theFileNameRendererof this renderer. In the PMD CLI, the file name renderer respects theAbstractConfiguration.getRelativizeRoots()relativize roots to output relative paths.A renderer does not have to use this method to output paths. Some report formats require a specific format for paths, eg URIs. They can implement this ad-hoc.
-
setWriter
Description copied from interface:RendererSet the Writer for the Renderer. -
getWriter
Description copied from interface:RendererGet the Writer for the Renderer. -
flush
public void flush() -
setReportFile
Sets the filename where the report should be written to. If no filename is provided, the renderer should write to stdout.Implementations must initialize the writer of the renderer.
See
setReportFile(String)for the default impl.This default implementation always uses the system default charset for the writer. Overwrite in specific renderers to support other charsets.
- Specified by:
setReportFilein interfaceRenderer- Parameters:
reportFilename- the filename (optional).
-