com.puppycrawl.tools.checkstyle.checks.header
Class AbstractHeaderCheck

java.lang.Object
  extended by com.puppycrawl.tools.checkstyle.api.AutomaticBean
      extended by com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
          extended by com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
              extended by com.puppycrawl.tools.checkstyle.checks.header.AbstractHeaderCheck
All Implemented Interfaces:
Configurable, Contextualizable, FileSetCheck
Direct Known Subclasses:
HeaderCheck, RegexpHeaderCheck

public abstract class AbstractHeaderCheck
extends AbstractFileSetCheck

Abstract super class for header checks. Provides support for header and headerFile properties.

Author:
o_sukhosolsky

Constructor Summary
AbstractHeaderCheck()
           
 
Method Summary
protected  void finishLocalSetup()
          Provides a hook to finish the part of this component's setup that was not handled by the bean introspection.
protected  List<String> getHeaderLines()
          Return the header lines to check against.
protected  void postprocessHeaderLines()
          Hook method for post processing header lines.
 void setCharset(String aCharset)
          Set the charset to use for loading the header from a file.
 void setHeader(String aHeader)
          Set the header to check against.
 void setHeaderFile(String aFileName)
          Set the header file to check against.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck
beginProcessing, destroy, finishProcessing, fireErrors, getMessageCollector, getMessageDispatcher, init, log, log, process, processFiltered, setFileExtensions, setMessageDispatcher
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, 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
 
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Configurable
configure
 
Methods inherited from interface com.puppycrawl.tools.checkstyle.api.Contextualizable
contextualize
 

Constructor Detail

AbstractHeaderCheck

public AbstractHeaderCheck()
Method Detail

getHeaderLines

protected List<String> getHeaderLines()
Return the header lines to check against.

Returns:
the header lines to check against.

setCharset

public void setCharset(String aCharset)
                throws UnsupportedEncodingException
Set the charset to use for loading the header from a file.

Parameters:
aCharset - the charset to use for loading the header from a file
Throws:
UnsupportedEncodingException - if aCharset is unsupported

setHeaderFile

public void setHeaderFile(String aFileName)
Set the header file to check against.

Parameters:
aFileName - the file that contains the header to check against.

setHeader

public void setHeader(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:
ConversionException - if the header cannot be interpreted

postprocessHeaderLines

protected void postprocessHeaderLines()
Hook method for post processing header lines. This implementation does nothing.


finishLocalSetup

protected final void finishLocalSetup()
                               throws CheckstyleException
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.

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

Back to the Checkstyle Home Page