Class AuditEvent
- java.lang.Object
-
- java.util.EventObject
-
- com.puppycrawl.tools.checkstyle.api.AuditEvent
-
- All Implemented Interfaces:
java.io.Serializable
public final class AuditEvent extends java.util.EventObject
Raw event for audit.I'm not very satisfied about the design of this event since there are optional methods that will return null in most of the case. This will need some work to clean it up especially if we want to introduce a more sequential reporting action rather than a packet reporting. This will allow for example to follow the process quickly in an interface or a servlet (yep, that's cool to run a check via a web interface in a source repository ;-)
- See Also:
AuditListener, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringfileNameFilename event associated with.private static longserialVersionUIDRecord a version.private ViolationviolationViolation associated with the event.
-
Constructor Summary
Constructors Constructor Description AuditEvent(java.lang.Object source)Creates a new instance.AuditEvent(java.lang.Object src, java.lang.String fileName)Creates a newAuditEventinstance.AuditEvent(java.lang.Object src, java.lang.String fileName, Violation violation)Creates a newAuditEventinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetColumn()Gets the column associated with the violation.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.SeverityLevelgetSeverityLevel()Gets the audit event severity level.java.lang.StringgetSourceName()Gets the name of the source for the violation.ViolationgetViolation()Gets the violation.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Record a version.- See Also:
- Constant Field Values
-
fileName
private final java.lang.String fileName
Filename event associated with.
-
-
Constructor Detail
-
AuditEvent
public AuditEvent(java.lang.Object source)
Creates a new instance.- Parameters:
source- the object that created the event
-
AuditEvent
public AuditEvent(java.lang.Object src, java.lang.String fileName)
Creates a newAuditEventinstance.- Parameters:
src- source of the eventfileName- file associated with the event
-
AuditEvent
public AuditEvent(java.lang.Object src, java.lang.String fileName, Violation violation)
Creates a newAuditEventinstance.- Parameters:
src- source of the eventfileName- file associated with the eventviolation- the actual violation
-
-
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.
-
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 event violation
-
getColumn
public int getColumn()
Gets the column associated with the violation.- Returns:
- the column associated with the violation
-
getSeverityLevel
public SeverityLevel getSeverityLevel()
Gets the audit event severity level.- Returns:
- the audit event severity level
-
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
-
getViolation
public Violation getViolation()
Gets the violation.- Returns:
- the violation
-
-