Class SuppressionsStringPrinter


  • public final class SuppressionsStringPrinter
    extends java.lang.Object
    Class for constructing xpath queries to suppress nodes with specified line and column number.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String generate​(FileText fileText, DetailAST detailAST, int lineNumber, int columnNumber, int tabWidth)
      Creates XpathQueryGenerator instance and generates suppressions.
      static java.lang.String printSuppressions​(java.io.File file, java.lang.String suppressionLineColumnNumber, int tabWidth)
      Prints generated suppressions.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • VALID_SUPPRESSION_LINE_COLUMN_NUMBER_REGEX

        private static final java.util.regex.Pattern VALID_SUPPRESSION_LINE_COLUMN_NUMBER_REGEX
        Line and column number config value pattern.
      • LINE_SEPARATOR

        private static final java.lang.String LINE_SEPARATOR
        OS specific line separator.
    • Constructor Detail

      • SuppressionsStringPrinter

        private SuppressionsStringPrinter()
        Prevent instances.
    • Method Detail

      • printSuppressions

        public static java.lang.String printSuppressions​(java.io.File file,
                                                         java.lang.String suppressionLineColumnNumber,
                                                         int tabWidth)
                                                  throws java.io.IOException,
                                                         CheckstyleException
        Prints generated suppressions.
        Parameters:
        file - the file to process.
        suppressionLineColumnNumber - line and column number of the suppression
        tabWidth - length of the tab character
        Returns:
        generated suppressions.
        Throws:
        java.io.IOException - if the file could not be read.
        java.lang.IllegalStateException - if suppressionLineColumnNumber is not of a valid format.
        CheckstyleException - if the file is not a Java source.
      • generate

        private static java.lang.String generate​(FileText fileText,
                                                 DetailAST detailAST,
                                                 int lineNumber,
                                                 int columnNumber,
                                                 int tabWidth)
        Creates XpathQueryGenerator instance and generates suppressions.
        Parameters:
        fileText - FileText object.
        detailAST - DetailAST object.
        lineNumber - line number.
        columnNumber - column number.
        tabWidth - length of the tab character.
        Returns:
        generated suppressions.