Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.puppycrawl.tools.checkstyle.api
Class AbstractViolationReporter  view AbstractViolationReporter download AbstractViolationReporter.java

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended bycom.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.


Field Summary
private static java.lang.Object[] EMPTY_OBJECT_ARRAY
          resuable constant for message formating
private  SeverityLevel mSeverityLevel
          the severity level of any violations found
 
Fields inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
 
Constructor Summary
AbstractViolationReporter()
           
 
Method Summary
protected  java.lang.String getMessageBundle()
          Returns the message bundle name resourcebundle that contains the messages used by this module.
(package private)  java.lang.String getMessageBundle(java.lang.String aClassName)
          for unit tests, especially with a class with no package name.
 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(int aLineNo, int aColNo, java.lang.String aKey)
          Helper method to log a LocalizedMessage.
protected  void log(int aLineNo, int aColNo, java.lang.String aKey, java.lang.Object aArg0)
          Helper method to log a LocalizedMessage.
protected abstract  void log(int aLine, int aCol, java.lang.String aKey, java.lang.Object[] aArgs)
          Log a message that has column information.
protected  void log(int aLineNo, int aColNo, java.lang.String aKey, java.lang.Object aArg0, java.lang.Object aArg1)
          Helper method to log a LocalizedMessage.
protected  void log(int aLine, java.lang.String aKey)
          Log a message.
protected  void log(int aLineNo, java.lang.String aKey, java.lang.Object aArg0)
          Helper method to log a LocalizedMessage.
protected abstract  void log(int aLine, java.lang.String aKey, java.lang.Object[] aArgs)
          Log a message that has no column information.
protected  void log(int aLineNo, java.lang.String aKey, java.lang.Object aArg0, java.lang.Object aArg1)
          Helper method to log a LocalizedMessage.
 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
 

Field Detail

EMPTY_OBJECT_ARRAY

private static final java.lang.Object[] EMPTY_OBJECT_ARRAY
resuable constant for message formating


mSeverityLevel

private SeverityLevel mSeverityLevel
the severity level of any violations found

Constructor Detail

AbstractViolationReporter

public AbstractViolationReporter()
Method Detail

getSeverityLevel

public final SeverityLevel getSeverityLevel()
Returns the severity level of the messages generated by this module.


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.


getSeverity

public final java.lang.String getSeverity()
Get the severity level's name.


log

protected final void log(int aLine,
                         java.lang.String aKey)
Log a message.


log

protected final void log(int aLineNo,
                         java.lang.String aKey,
                         java.lang.Object aArg0)
Helper method to log a LocalizedMessage. Column defaults to 0.


log

protected final void log(int aLineNo,
                         java.lang.String aKey,
                         java.lang.Object aArg0,
                         java.lang.Object aArg1)
Helper method to log a LocalizedMessage. Column defaults to 0.


log

protected final void log(int aLineNo,
                         int aColNo,
                         java.lang.String aKey)
Helper method to log a LocalizedMessage.


log

protected final void log(int aLineNo,
                         int aColNo,
                         java.lang.String aKey,
                         java.lang.Object aArg0)
Helper method to log a LocalizedMessage.


log

protected final void log(int aLineNo,
                         int aColNo,
                         java.lang.String aKey,
                         java.lang.Object aArg0,
                         java.lang.Object aArg1)
Helper method to log a LocalizedMessage.


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.


getMessageBundle

java.lang.String getMessageBundle(java.lang.String aClassName)
for unit tests, especially with a class with no package name.


log

protected abstract void log(int aLine,
                            java.lang.String aKey,
                            java.lang.Object[] aArgs)
Log a message that has no column information.


log

protected abstract void log(int aLine,
                            int aCol,
                            java.lang.String aKey,
                            java.lang.Object[] aArgs)
Log a message that has column information.