com.puppycrawl.tools.checkstyle.checks
Class AbstractHeaderCheck

java.lang.Object
  extended bycom.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended bycom.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
          extended bycom.puppycrawl.tools.checkstyle.api.Check
              extended bycom.puppycrawl.tools.checkstyle.checks.AbstractHeaderCheck
All Implemented Interfaces:
Configurable, Contextualizable
Direct Known Subclasses:
HeaderCheck, RegexpHeaderCheck

public abstract class AbstractHeaderCheck
extends Check

Abstract super class for header checks. Provides support for headerFile property.

Author:
o_sukhosolsky

Constructor Summary
AbstractHeaderCheck()
           
 
Method Summary
protected  void finishLocalSetup()
          Checks that required args were specified.
 int[] getDefaultTokens()
          Returns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.
protected  java.lang.String[] getHeaderLines()
          Return the header lines to check against.
 void setHeader(java.lang.String aHeader)
          Set the header to check against.
 void setHeaderFile(java.lang.String aFileName)
          Set the header file to check against.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setSeverity
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHeaderCheck

public AbstractHeaderCheck()
Method Detail

getHeaderLines

protected java.lang.String[] getHeaderLines()
Return the header lines to check against.

Returns:
the header lines to check against.

setHeaderFile

public void setHeaderFile(java.lang.String aFileName)
                   throws org.apache.commons.beanutils.ConversionException
Set the header file to check against.

Parameters:
aFileName - the file that contains the header to check against.
Throws:
org.apache.commons.beanutils.ConversionException - if the file cannot be loaded

setHeader

public void setHeader(java.lang.String aHeader)
Set the header to check against. Individual lines in the header must be separated by '\n' characters.

Parameters:
aHeader - header content to check against.
Throws:
org.apache.commons.beanutils.ConversionException - if the header cannot be interpreted

finishLocalSetup

protected final void finishLocalSetup()
                               throws CheckstyleException
Checks that required args were specified.

Overrides:
finishLocalSetup in class AutomaticBean
Throws:
CheckstyleException - if there is a configuration error.
See Also:
AutomaticBean.finishLocalSetup()

getDefaultTokens

public final int[] getDefaultTokens()
Returns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.

Specified by:
getDefaultTokens in class Check
Returns:
the default tokens
See Also:
TokenTypes

Back to the Checkstyle Home Page