Package com.puppycrawl.tools.checkstyle
Class TreeWalkerAuditEvent
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.TreeWalkerAuditEvent
-
public class TreeWalkerAuditEvent extends java.lang.Object
RawTreeWalkerevent for audit.
-
-
Field Summary
Fields Modifier and Type Field Description private FileContentsfileContentsThe file contents.private java.lang.StringfileNameFilename event associated with.private DetailASTrootAstRoot ast element.private ViolationviolationViolation associated with the event.
-
Constructor Summary
Constructors Constructor Description TreeWalkerAuditEvent(FileContents fileContents, java.lang.String fileName, Violation violation, DetailAST rootAst)Creates a newTreeWalkerAuditEventinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetColumn()Gets the column associated with the violation.intgetColumnCharIndex()Gets the column char index associated with the violation.FileContentsgetFileContents()Returns contents of the file.java.lang.StringgetFileName()Returns name of file being audited.intgetLine()Return the line number on the source file where the event occurred.java.lang.StringgetMessage()Return the violation associated to the event.java.lang.StringgetModuleId()Returns id of module.DetailASTgetRootAst()Gets the root element of the AST tree.java.lang.StringgetSourceName()Gets the name of the source for the violation.intgetTokenType()Gets the token type of the violation.ViolationgetViolation()Gets the violation.
-
-
-
Field Detail
-
fileName
private final java.lang.String fileName
Filename event associated with.
-
fileContents
private final FileContents fileContents
The file contents.
-
-
Constructor Detail
-
TreeWalkerAuditEvent
public TreeWalkerAuditEvent(FileContents fileContents, java.lang.String fileName, Violation violation, DetailAST rootAst)
Creates a newTreeWalkerAuditEventinstance.- Parameters:
fileContents- contents of the file associated with the eventfileName- file associated with the eventviolation- the actual violationrootAst- root AST elementDetailASTof the file
-
-
Method Detail
-
getFileName
public java.lang.String getFileName()
Returns name of file being audited.- Returns:
- the file name currently being audited or null if there is no relation to a file.
-
getFileContents
public FileContents getFileContents()
Returns contents of the file.- Returns:
- contents of the file.
-
getViolation
public Violation getViolation()
Gets the violation.- Returns:
- the violation
-
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 java.lang.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 java.lang.String getModuleId()
Returns id of module.- Returns:
- the identifier of the module that generated the event. Can return null.
-
getSourceName
public java.lang.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
-
getRootAst
public DetailAST getRootAst()
Gets the root element of the AST tree.- Returns:
- the root element of the AST tree
-
-