Class AbstractRenderer

    • Field Detail

      • description

        protected String description
      • showSuppressedViolations

        protected boolean showSuppressedViolations
      • writer

        protected Writer writer
      • inputPathPrefixes

        protected List<String> inputPathPrefixes
    • Constructor Detail

      • AbstractRenderer

        public AbstractRenderer​(String name,
                                String description)
    • Method Detail

      • setName

        public void setName​(String name)
        Description copied from interface: Renderer
        Set the name of the Renderer.
        Specified by:
        setName in interface Renderer
        Parameters:
        name - The name of the Renderer.
      • getDescription

        public String getDescription()
        Description copied from interface: Renderer
        Get the description of the Renderer.
        Specified by:
        getDescription in interface Renderer
        Returns:
        The description of the Renderer.
      • setDescription

        public void setDescription​(String description)
        Description copied from interface: Renderer
        Set the description of the Renderer.
        Specified by:
        setDescription in interface Renderer
        Parameters:
        description - The description of the Renderer.
      • isShowSuppressedViolations

        public boolean isShowSuppressedViolations()
        Description copied from interface: Renderer
        Get the indicator for whether to show suppressed violations.
        Specified by:
        isShowSuppressedViolations in interface Renderer
        Returns:
        true if suppressed violations should show, false otherwise.
      • setShowSuppressedViolations

        public void setShowSuppressedViolations​(boolean showSuppressedViolations)
        Description copied from interface: Renderer
        Set the indicator for whether to show suppressed violations.
        Specified by:
        setShowSuppressedViolations in interface Renderer
        Parameters:
        showSuppressedViolations - Whether to show suppressed violations.
      • setUseShortNames

        public void setUseShortNames​(List<String> inputPaths)
        Description copied from interface: Renderer
        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 of inputPaths is empty, then the full pathnames are used.
        Specified by:
        setUseShortNames in interface Renderer
      • determineFileName

        protected String determineFileName​(String inputFileName)
        Determines the filename that should be used in the report depending on the option "shortnames". If the option is enabled, then the filename in the report is without the directory prefix of the directories, that have been analyzed. If the option "shortnames" is not enabled, then the inputFileName is returned as-is.
        Parameters:
        inputFileName -
        Returns:
        See Also:
        PMDConfiguration.isReportShortNames(), PMDParameters.isShortnames()
      • setWriter

        public void setWriter​(Writer writer)
        Description copied from interface: Renderer
        Set the Writer for the Renderer.
        Specified by:
        setWriter in interface Renderer
        Parameters:
        writer - The Writer.
      • getWriter

        public Writer getWriter()
        Description copied from interface: Renderer
        Get the Writer for the Renderer.
        Specified by:
        getWriter in interface Renderer
        Returns:
        The Writer.
      • flush

        public void flush()
        Specified by:
        flush in interface Renderer
      • setReportFile

        @Experimental
        public void setReportFile​(String reportFilename)
        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:
        setReportFile in interface Renderer
        Parameters:
        reportFilename - the filename (optional).