Class AbstractViolationReporter
java.lang.Object
com.puppycrawl.tools.checkstyle.api.AutomaticBean
com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
- All Implemented Interfaces:
Configurable
,Contextualizable
- Direct Known Subclasses:
AbstractCheck
,AbstractFileSetCheck
Serves as an abstract base class for all modules that report inspection
findings. Such modules have a Severity level which is used for the
localized messages
that are created by the module.-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.Returns an unmodifiable map instance containing the custom messages for this configuration.final String
getId()
Returns the identifier of the reporter.protected String
Returns the message bundle name resource bundle that contains the messages used by this module.final String
Get the severity level's name.final SeverityLevel
Returns the severity level of the messages generated by this module.abstract void
Log a message that has column information.abstract void
Log a message that has no column information.final void
Sets the identifier of the reporter.final void
setSeverity
(String severity) Sets the severity level.Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Constructor Details
-
AbstractViolationReporter
public AbstractViolationReporter()
-
-
Method Details
-
getSeverityLevel
Returns the severity level of the messages generated by this module.- Returns:
- the severity level
- See Also:
-
setSeverity
Sets the severity level. The string should be one of the names defined in theSeverityLevel
class.- Parameters:
severity
- The new severity level- See Also:
-
getSeverity
Get the severity level's name.- Returns:
- the check's severity level name.
-
getId
Returns the identifier of the reporter. Can be null.- Returns:
- the id
-
setId
Sets the identifier of the reporter. Can be null.- Parameters:
id
- the id
-
getCustomMessages
Returns an unmodifiable map instance containing the custom messages for this configuration.- Returns:
- unmodifiable map containing custom messages
-
getMessageBundle
Returns the message bundle name resource bundle that contains the messages used by this module.The default implementation expects the resource files to be named messages.properties, messages_de.properties, etc. The file must be placed in the same package as the module implementation.
Example: If you write com/foo/MyCoolCheck, create resource files com/foo/messages.properties, com/foo/messages_de.properties, etc.
- Returns:
- name of a resource bundle that contains the messages used by this module.
-
finishLocalSetup
Description copied from class:AutomaticBean
Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.The default implementation does nothing.
- Specified by:
finishLocalSetup
in classAutomaticBean
- Throws:
CheckstyleException
- if there is a configuration error.
-
log
Log a message that has no column information.- Parameters:
line
- the line number where the audit event was foundkey
- the message that describes the audit eventargs
- the details of the message- See Also:
-
log
Log a message that has column information.- Parameters:
line
- the line number where the audit event was foundcol
- the column number where the audit event was foundkey
- the message that describes the audit eventargs
- the details of the message- See Also:
-