Class SeverityLevelCounter
java.lang.Object
com.puppycrawl.tools.checkstyle.api.SeverityLevelCounter
- All Implemented Interfaces:
AuditListener
,EventListener
An audit listener that counts how many
AuditEvents
of a given severity have been generated.-
Field Summary
Modifier and TypeFieldDescriptionprivate final AtomicInteger
Keeps track of the number of counted events.private final SeverityLevel
The severity level to watch out for. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addError
(AuditEvent event) Notify that an audit error was discovered on a specific file.void
addException
(AuditEvent event, Throwable throwable) Notify that an exception happened while performing audit.void
auditFinished
(AuditEvent event) Notify that the audit is finished.void
auditStarted
(AuditEvent event) Notify that the audit is about to start.void
fileFinished
(AuditEvent event) Notify that audit is finished on a specific file.void
fileStarted
(AuditEvent event) Notify that audit is about to start on a specific file.int
getCount()
Returns the number of counted events since audit started.
-
Field Details
-
level
The severity level to watch out for. -
count
Keeps track of the number of counted events.
-
-
Constructor Details
-
SeverityLevelCounter
Creates a new counter.- Parameters:
level
- the severity level events need to have, must be non-null.- Throws:
IllegalArgumentException
- when level is null
-
-
Method Details
-
addError
Description copied from interface:AuditListener
Notify that an audit error was discovered on a specific file.- Specified by:
addError
in interfaceAuditListener
- Parameters:
event
- the event details
-
addException
Description copied from interface:AuditListener
Notify that an exception happened while performing audit.- Specified by:
addException
in interfaceAuditListener
- Parameters:
event
- the event detailsthrowable
- details of the exception
-
auditStarted
Description copied from interface:AuditListener
Notify that the audit is about to start.- Specified by:
auditStarted
in interfaceAuditListener
- Parameters:
event
- the event details
-
fileStarted
Description copied from interface:AuditListener
Notify that audit is about to start on a specific file.- Specified by:
fileStarted
in interfaceAuditListener
- Parameters:
event
- the event details
-
auditFinished
Description copied from interface:AuditListener
Notify that the audit is finished.- Specified by:
auditFinished
in interfaceAuditListener
- Parameters:
event
- the event details
-
fileFinished
Description copied from interface:AuditListener
Notify that audit is finished on a specific file.- Specified by:
fileFinished
in interfaceAuditListener
- Parameters:
event
- the event details
-
getCount
Returns the number of counted events since audit started.- Returns:
- the number of counted events since audit started.
-