Record Class TreeWalkerAuditEvent

java.lang.Object
java.lang.Record
com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent
Record Components:
fileContents - contents of the file associated with the event
fileName - file associated with the event
violation - the actual violation
rootAst - root AST element DetailAST of the file

public record TreeWalkerAuditEvent(FileContents fileContents, String fileName, Violation violation, DetailAST rootAst) extends Record
Raw TreeWalker event for audit.
  • Field Details

    • fileContents

      private final FileContents fileContents
      The field for the fileContents record component.
    • fileName

      private final String fileName
      The field for the fileName record component.
    • violation

      private final Violation violation
      The field for the violation record component.
    • rootAst

      private final DetailAST rootAst
      The field for the rootAst record component.
  • Constructor Details

    • TreeWalkerAuditEvent

      public TreeWalkerAuditEvent(FileContents fileContents, String fileName, Violation violation, DetailAST rootAst)
      Creates an instance of a TreeWalkerAuditEvent record class.
      Parameters:
      fileContents - the value for the fileContents record component
      fileName - the value for the fileName record component
      violation - the value for the violation record component
      rootAst - the value for the rootAst record component
  • Method Details

    • getLine

      public int getLine()
      Return the line number on the source file where the event occurred. This may be 0 if there is no relation to a file content.
      Returns:
      an integer representing the line number in the file source code.
    • getMessage

      public String getMessage()
      Return the violation associated to the event.
      Returns:
      the violation message
    • getColumn

      public int getColumn()
      Gets the column associated with the violation.
      Returns:
      the column associated with the violation
    • getColumnCharIndex

      public int getColumnCharIndex()
      Gets the column char index associated with the violation.
      Returns:
      the column char index associated with the violation
    • getModuleId

      public String getModuleId()
      Returns id of module.
      Returns:
      the identifier of the module that generated the event. Can return null.
    • getSourceName

      public String getSourceName()
      Gets the name of the source for the violation.
      Returns:
      the name of the source for the violation
    • getTokenType

      public int getTokenType()
      Gets the token type of the violation.
      Returns:
      the token type of the violation
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • fileContents

      public FileContents fileContents()
      Returns the value of the fileContents record component.
      Returns:
      the value of the fileContents record component
    • fileName

      public String fileName()
      Returns the value of the fileName record component.
      Returns:
      the value of the fileName record component
    • violation

      public Violation violation()
      Returns the value of the violation record component.
      Returns:
      the value of the violation record component
    • rootAst

      public DetailAST rootAst()
      Returns the value of the rootAst record component.
      Returns:
      the value of the rootAst record component