com.puppycrawl.tools.checkstyle
Class Checker

java.lang.Object
  |
  +--com.puppycrawl.tools.checkstyle.Checker
All Implemented Interfaces:
Defn

public class Checker
extends java.lang.Object
implements Defn

This class provides the functionality to check a set of files.

Author:
Oliver Burn, Stephane Bailliez

Field Summary
 
Fields inherited from interface com.puppycrawl.tools.checkstyle.Defn
ALL_BLOCK_PROPS, ALL_BOOLEAN_PROPS, ALL_INT_PROPS, ALL_LCURLY_PROPS, ALL_PATTERN_PROPS, ALL_STRING_PROPS, ALL_STRING_SET_PROPS, ALLOW_NO_AUTHOR_PROP, ALLOW_PACKAGE_PROP, ALLOW_PROTECTED_PROP, ALLOW_TABS_PROP, BASEDIR_PROP, CACHE_FILE_PROP, CATCH_BLOCK_PROP, CONST_PATTERN_PROP, FINALLY_BLOCK_PROP, HEADER_FILE_PROP, HEADER_IGNORE_LINE_PROP, HEADER_LINES_REGEXP_PROP, IGNORE_BRACES_PROP, IGNORE_CAST_WHITESPACE_PROP, IGNORE_IMPORT_LENGTH_PROP, IGNORE_IMPORTS_PROP, IGNORE_LINE_LENGTH_PATTERN_PROP, IGNORE_LONG_ELL_PROP, IGNORE_PUBLIC_IN_INTERFACE_PROP, IGNORE_WHITESPACE_PROP, ILLEGAL_IMPORTS_PROP, ILLEGAL_INSTANTIATIONS_PROP, JAVADOC_CHECK_UNUSED_THROWS_PROP, JAVADOC_CHECKSCOPE_PROP, LCURLY_METHOD_PROP, LCURLY_OTHER_PROP, LCURLY_TYPE_PROP, LOCAL_FINAL_VAR_PATTERN_PROP, LOCAL_VAR_PATTERN_PROP, LOCALE_COUNTRY_PROP, LOCALE_LANGUAGE_PROP, MAX_CONSTRUCTOR_LENGTH_PROP, MAX_FILE_LENGTH_PROP, MAX_LINE_LENGTH_PROP, MAX_METHOD_LENGTH_PROP, MAX_PARAMETERS_PROP, MEMBER_PATTERN_PROP, METHOD_PATTERN_PROP, PACKAGE_PATTERN_PROP, PARAMETER_PATTERN_PROP, PAREN_PAD_PROP, PUBLIC_MEMBER_PATTERN_PROP, RCURLY_PROP, REQUIRE_PACKAGE_HTML_PROP, REQUIRE_VERSION_PROP, STATIC_PATTERN_PROP, TAB_WIDTH_PROP, TODO_PATTERN_PROP, TRY_BLOCK_PROP, TYPE_PATTERN_PROP, WRAP_OP_PROP
 
Constructor Summary
Checker(Configuration aConfig)
          Constructs the object.
 
Method Summary
 void addListener(AuditListener aListener)
          Add the listener that will be used to receive events from the audit
 void destroy()
          Cleans up the object
protected  void fireAuditFinished()
          notify all listeners about the audit end
protected  void fireAuditStarted()
          notify all listeners about the audit start
protected  void fireErrors(java.lang.String aFileName, LocalizedMessage[] aErrors)
          notify all listeners about the errors in a file.
protected  void fireFileFinished(java.lang.String aFileName)
          notify all listeners about the end of a file audit
protected  void fireFileStarted(java.lang.String aFileName)
          notify all listeners about the beginning of a file audit
 int process(java.lang.String[] aFiles)
          Processes a set of files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Checker

public Checker(Configuration aConfig)
        throws org.apache.regexp.RESyntaxException,
               java.io.IOException
Constructs the object.

Parameters:
aConfig - contains the configuration to check with
Throws:
org.apache.regexp.RESyntaxException - unable to create a regexp object
java.io.IOException - if an error occurs
Method Detail

destroy

public void destroy()
Cleans up the object


addListener

public void addListener(AuditListener aListener)
Add the listener that will be used to receive events from the audit

Parameters:
aListener - the nosy thing

process

public int process(java.lang.String[] aFiles)
Processes a set of files. Once this is done, it is highly recommended to call for the destroy method to close and remove the listeners.

Parameters:
aFiles - the list of files to be audited.
Returns:
the total number of errors found
See Also:
destroy()

fireAuditStarted

protected void fireAuditStarted()
notify all listeners about the audit start


fireAuditFinished

protected void fireAuditFinished()
notify all listeners about the audit end


fireFileStarted

protected void fireFileStarted(java.lang.String aFileName)
notify all listeners about the beginning of a file audit

Parameters:
aFileName - the file to be audited

fireFileFinished

protected void fireFileFinished(java.lang.String aFileName)
notify all listeners about the end of a file audit

Parameters:
aFileName - the audited file

fireErrors

protected void fireErrors(java.lang.String aFileName,
                          LocalizedMessage[] aErrors)
notify all listeners about the errors in a file.

Parameters:
aFileName - the audited file
aErrors - the audit errors from the file