Package com.puppycrawl.tools.checkstyle
Record Class TreeWalkerAuditEvent
java.lang.Object
java.lang.Record
com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent
- Record Components:
fileContents- contents of the file associated with the eventfileName- file associated with the eventviolation- the actual violationrootAst- root AST elementDetailASTof the file
public record TreeWalkerAuditEvent(FileContents fileContents, String fileName, Violation violation, DetailAST rootAst)
extends Record
Raw
TreeWalker event for audit.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FileContentsThe field for thefileContentsrecord component.private final StringThe field for thefileNamerecord component.private final DetailASTThe field for therootAstrecord component.private final ViolationThe field for theviolationrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionTreeWalkerAuditEvent(FileContents fileContents, String fileName, Violation violation, DetailAST rootAst) Creates an instance of aTreeWalkerAuditEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of thefileContentsrecord component.fileName()Returns the value of thefileNamerecord component.intGets the column associated with the violation.intGets the column char index associated with the violation.intgetLine()Return the line number on the source file where the event occurred.Return the violation associated to the event.Returns id of module.Gets the name of the source for the violation.intGets the token type of the violation.final inthashCode()Returns a hash code value for this object.rootAst()Returns the value of therootAstrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theviolationrecord component.
-
Field Details
-
fileContents
The field for thefileContentsrecord component. -
fileName
The field for thefileNamerecord component. -
violation
The field for theviolationrecord component. -
rootAst
The field for therootAstrecord component.
-
-
Constructor Details
-
TreeWalkerAuditEvent
public TreeWalkerAuditEvent(FileContents fileContents, String fileName, Violation violation, DetailAST rootAst) Creates an instance of aTreeWalkerAuditEventrecord class.- Parameters:
fileContents- the value for thefileContentsrecord componentfileName- the value for thefileNamerecord componentviolation- the value for theviolationrecord componentrootAst- the value for therootAstrecord component
-
-
Method Details
-
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
Return the violation associated to the event.- Returns:
- the violation message
-
getColumn
Gets the column associated with the violation.- Returns:
- the column associated with the violation
-
getColumnCharIndex
Gets the column char index associated with the violation.- Returns:
- the column char index associated with the violation
-
getModuleId
Returns id of module.- Returns:
- the identifier of the module that generated the event. Can return null.
-
getSourceName
Gets the name of the source for the violation.- Returns:
- the name of the source for the violation
-
getTokenType
Gets the token type of the violation.- Returns:
- the token type of the violation
-
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. -
hashCode
Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
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 withObjects::equals(Object,Object). -
fileContents
Returns the value of thefileContentsrecord component.- Returns:
- the value of the
fileContentsrecord component
-
fileName
Returns the value of thefileNamerecord component.- Returns:
- the value of the
fileNamerecord component
-
violation
Returns the value of theviolationrecord component.- Returns:
- the value of the
violationrecord component
-
rootAst
Returns the value of therootAstrecord component.- Returns:
- the value of the
rootAstrecord component
-