## com.puppycrawl.tools.checkstyle.api
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:
  AbstractFileSetCheck, Check

    public abstract class AbstractViolationReporter

extends AutomaticBean

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.

Author:
  lkuehne

Constructor Summary
`AbstractViolationReporter()`

Method Summary
`protected java.util.Map<java.lang.String,java.lang.String>` `getCustomMessages()` Returns an unmodifiable map instance containing the custom messages for this configuration.
`java.lang.String` `getId()` Returns the identifier of the reporter.
`protected java.lang.String` `getMessageBundle()` Returns the message bundle name resourcebundle that contains the messages used by this module.
`java.lang.String` `getSeverity()` Get the severity level's name.
`SeverityLevel` `getSeverityLevel()` Returns the severity level of the messages generated by this module.
`protected void` `log(DetailAST aAST, java.lang.String aKey, java.lang.Object... aArgs)` Helper method to log a LocalizedMessage.
`abstract void` `log(int aLine, int aCol, java.lang.String aKey, java.lang.Object... aArgs)` Log a message that has column information.
`abstract void` `log(int aLine, java.lang.String aKey, java.lang.Object... aArgs)` Log a message that has no column information.
`void` `setId(java.lang.String aId)` Sets the identifier of the reporter.
`void` `setSeverity(java.lang.String aSeverity)` Sets the severity level.

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, finishLocalSetup, getConfiguration, setupChild`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractViolationReporter

    public AbstractViolationReporter()

Method Detail

### getSeverityLevel

    public final SeverityLevel getSeverityLevel()

  Returns the severity level of the messages generated by this module.

  Returns:
    the severity level
  See Also:
    `SeverityLevel`, `LocalizedMessage.getSeverityLevel()`

### setSeverity

    public final void setSeverity(java.lang.String aSeverity)

  Sets the severity level. The string should be one of the names defined in the `SeverityLevel` class.

  Parameters:
    `aSeverity` - The new severity level
  See Also:
    `SeverityLevel`

### getSeverity

    public final java.lang.String getSeverity()

  Get the severity level's name.

  Returns:
    the check's severity level name.

### getId

    public final java.lang.String getId()

  Returns the identifier of the reporter. Can be null.

  Returns:
    the id

### setId

    public final void setId(java.lang.String aId)

  Sets the identifier of the reporter. Can be null.

  Parameters:
    `aId` - the id

### log

    protected final void log(DetailAST aAST,
                             java.lang.String aKey,
                             java.lang.Object... aArgs)

  Helper method to log a LocalizedMessage.

  Parameters:
    `aAST` - a node to get line and column numbers associated with the message
    `aKey` - key to locale message format
    `aArgs` - arguments to format

### getMessageBundle

    protected java.lang.String getMessageBundle()

  Returns the message bundle name resourcebundle 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.

### getCustomMessages

    protected java.util.Map<java.lang.String,java.lang.String> getCustomMessages()

  Returns an unmodifiable map instance containing the custom messages for this configuration.

  Returns:
    unmodifiable map containing custom messages

### log

    public abstract void log(int aLine,
                             java.lang.String aKey,
                             java.lang.Object... aArgs)

  Log a message that has no column information.

  Parameters:
    `aLine` - the line number where the error was found
    `aKey` - the message that describes the error
    `aArgs` - the details of the message
  See Also:
    `MessageFormat`

### log

    public abstract void log(int aLine,
                             int aCol,
                             java.lang.String aKey,
                             java.lang.Object... aArgs)

  Log a message that has column information.

  Parameters:
    `aLine` - the line number where the error was found
    `aCol` - the column number where the error was found
    `aKey` - the message that describes the error
    `aArgs` - the details of the message
  See Also:
    `MessageFormat`

Copyright © 2001-2010. All Rights Reserved.