com.puppycrawl.tools.checkstyle
Class Configuration

java.lang.Object
  |
  +--com.puppycrawl.tools.checkstyle.Configuration
All Implemented Interfaces:
java.io.Serializable

public class Configuration
extends java.lang.Object
implements java.io.Serializable

Represents the configuration that checkstyle uses when checking. The configuration is Serializable, however the ClassLoader configuration is lost.

Author:
Oliver Burn
See Also:
Serialized Form

Constructor Summary
Configuration()
          Creates a new Configuration instance.
Configuration(java.util.Properties aProps, java.io.PrintStream aLog)
          Creates a new Configuration instance.
 
Method Summary
 java.lang.String getBasedir()
           
 java.lang.String getCacheFile()
           
 BlockOption getCatchBlock()
           
 java.lang.ClassLoader getClassLoader()
           
 BlockOption getFinallyBlock()
           
 java.lang.String[] getHeaderLines()
           
 boolean getHeaderLinesRegexp()
           
 java.lang.String getIgnoreLineLengthPat()
           
 org.apache.regexp.RE getIgnoreLineLengthRegexp()
           
 java.util.Set getIllegalImports()
           
 java.util.Set getIllegalInstantiations()
           
 Scope getJavadocScope()
           
 LeftCurlyOption getLCurlyMethod()
           
 LeftCurlyOption getLCurlyOther()
           
 LeftCurlyOption getLCurlyType()
           
 java.lang.String getLocalVarPat()
           
 org.apache.regexp.RE getLocalVarRegexp()
           
 int getMaxConstructorLength()
           
 int getMaxFileLength()
           
 int getMaxLineLength()
           
 int getMaxMethodLength()
           
 java.lang.String getMemberPat()
           
 org.apache.regexp.RE getMemberRegexp()
           
 java.lang.String getMethodPat()
           
 org.apache.regexp.RE getMethodRegexp()
           
 java.lang.String getParamPat()
           
 org.apache.regexp.RE getParamRegexp()
           
 PadOption getParenPadOption()
           
 java.lang.String getPublicMemberPat()
           
 org.apache.regexp.RE getPublicMemberRegexp()
           
 RightCurlyOption getRCurly()
           
 java.lang.String getStaticFinalPat()
           
 org.apache.regexp.RE getStaticFinalRegexp()
           
 java.lang.String getStaticPat()
           
 org.apache.regexp.RE getStaticRegexp()
           
 int getTabWidth()
           
 java.lang.String getTodoPat()
           
 org.apache.regexp.RE getTodoRegexp()
           
 BlockOption getTryBlock()
           
 java.lang.String getTypePat()
           
 org.apache.regexp.RE getTypeRegexp()
           
 WrapOpOption getWrapOpOption()
           
 boolean isAllowNoAuthor()
           
 boolean isAllowPackage()
           
 boolean isAllowProtected()
           
 boolean isAllowTabs()
           
 boolean isCheckUnusedThrows()
           
 boolean isHeaderIgnoreLineNo(int aLineNo)
           
 boolean isIgnoreBraces()
           
 boolean isIgnoreCastWhitespace()
           
 boolean isIgnoreImportLength()
           
 boolean isIgnoreImports()
           
 boolean isIgnoreLongEll()
           
 boolean isIgnorePublicInInterface()
           
 boolean isIgnoreWhitespace()
           
 boolean isRequirePackageHtml()
           
 void setBasedir(java.lang.String aTo)
           
 void setBlockOptionProperty(java.lang.String aName, BlockOption aTo)
          Set an BlockOption property.
 void setBooleanProperty(java.lang.String aName, boolean aTo)
          Set the boolean property.
 void setCacheFile(java.lang.String aCacheFile)
           
 void setClassLoader(java.lang.ClassLoader aLoader)
          Set the class loader for locating classes.
 void setHeaderFile(java.lang.String aFileName)
           
 void setHeaderIgnoreLines(java.lang.String aList)
           
 void setIllegalImports(java.lang.String aPkgPrefixList)
           
 void setIllegalInstantiations(java.lang.String aClassList)
           
 void setIntProperty(java.lang.String aName, int aTo)
          Set an integer property.
 void setJavadocScope(Scope aJavadocScope)
           
 void setLeftCurlyOptionProperty(java.lang.String aName, LeftCurlyOption aTo)
          Set an LeftCurlyOption property.
 void setParenPadOption(PadOption aTo)
           
 void setPatternProperty(java.lang.String aName, java.lang.String aPat)
          Set an pattern property.
 void setRCurly(RightCurlyOption aTo)
           
 void setWrapOpOption(WrapOpOption aTo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration(java.util.Properties aProps,
                     java.io.PrintStream aLog)
              throws org.apache.regexp.RESyntaxException,
                     java.io.FileNotFoundException,
                     java.io.IOException
Creates a new Configuration instance.
Parameters:
aProps - where to extract configuration parameters from
aLog - where to log errors to
Throws:
org.apache.regexp.RESyntaxException - if an error occurs
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs

Configuration

public Configuration()
Creates a new Configuration instance.
Throws:
IllegalStateException - if an error occurs
Method Detail

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns:
the class loader

getTodoPat

public java.lang.String getTodoPat()
Returns:
pattern to match todo lines

getTodoRegexp

public org.apache.regexp.RE getTodoRegexp()
Returns:
regexp to match todo lines

getParamPat

public java.lang.String getParamPat()
Returns:
pattern to match parameters

getParamRegexp

public org.apache.regexp.RE getParamRegexp()
Returns:
regexp to match parameters

getStaticPat

public java.lang.String getStaticPat()
Returns:
pattern to match static variables

getStaticRegexp

public org.apache.regexp.RE getStaticRegexp()
Returns:
regexp to match static variables

getStaticFinalPat

public java.lang.String getStaticFinalPat()
Returns:
pattern to match static final variables

getStaticFinalRegexp

public org.apache.regexp.RE getStaticFinalRegexp()
Returns:
regexp to match static final variables

getMemberPat

public java.lang.String getMemberPat()
Returns:
pattern to match member variables

getMemberRegexp

public org.apache.regexp.RE getMemberRegexp()
Returns:
regexp to match member variables

getPublicMemberPat

public java.lang.String getPublicMemberPat()
Returns:
pattern to match public member variables

getPublicMemberRegexp

public org.apache.regexp.RE getPublicMemberRegexp()
Returns:
regexp to match public member variables

getTypePat

public java.lang.String getTypePat()
Returns:
pattern to match type names

getTypeRegexp

public org.apache.regexp.RE getTypeRegexp()
Returns:
regexp to match type names

getLocalVarPat

public java.lang.String getLocalVarPat()
Returns:
pattern to match local variables

getLocalVarRegexp

public org.apache.regexp.RE getLocalVarRegexp()
Returns:
regexp to match local variables

getMethodPat

public java.lang.String getMethodPat()
Returns:
pattern to match method names

getMethodRegexp

public org.apache.regexp.RE getMethodRegexp()
Returns:
regexp to match method names

getMaxLineLength

public int getMaxLineLength()
Returns:
the maximum line length

getMaxMethodLength

public int getMaxMethodLength()
Returns:
the maximum method length

getMaxConstructorLength

public int getMaxConstructorLength()
Returns:
the maximum constructor length

getMaxFileLength

public int getMaxFileLength()
Returns:
the maximum file length

isAllowTabs

public boolean isAllowTabs()
Returns:
whether to allow tabs

getTabWidth

public int getTabWidth()
Returns:
distance between tab stops

isAllowProtected

public boolean isAllowProtected()
Returns:
whether to allow protected data

isAllowPackage

public boolean isAllowPackage()
Returns:
whether to allow package data

isAllowNoAuthor

public boolean isAllowNoAuthor()
Returns:
whether to allow having no author tag

getJavadocScope

public Scope getJavadocScope()
Returns:
visibility scope where Javadoc is checked

isRequirePackageHtml

public boolean isRequirePackageHtml()
Returns:
whether javadoc package documentation is required

isIgnoreImports

public boolean isIgnoreImports()
Returns:
whether to process imports

isCheckUnusedThrows

public boolean isCheckUnusedThrows()
Returns:
whether to check unused @throws

getIllegalImports

public java.util.Set getIllegalImports()
Returns:
Set of pkg prefixes that are illegal in import statements

getIllegalInstantiations

public java.util.Set getIllegalInstantiations()
Returns:
Set of classes where calling a constructor is illegal

getIgnoreLineLengthPat

public java.lang.String getIgnoreLineLengthPat()
Returns:
pattern to exclude from line lengh checking

getIgnoreLineLengthRegexp

public org.apache.regexp.RE getIgnoreLineLengthRegexp()
Returns:
regexp to exclude from line lengh checking

isIgnoreWhitespace

public boolean isIgnoreWhitespace()
Returns:
whether to ignore checks for whitespace

isIgnoreCastWhitespace

public boolean isIgnoreCastWhitespace()
Returns:
whether to ignore checks for whitespace after casts

isIgnoreBraces

public boolean isIgnoreBraces()
Returns:
whether to ignore checks for braces

isIgnoreLongEll

public boolean isIgnoreLongEll()
Returns:
whether to ignore long 'L'

isIgnorePublicInInterface

public boolean isIgnorePublicInInterface()
Returns:
whether to ignore 'public' keyword in interface definitions

isIgnoreImportLength

public boolean isIgnoreImportLength()
Returns:
whether to ignore max line length for import statements

getHeaderLines

public java.lang.String[] getHeaderLines()
Returns:
the header lines to check for

getHeaderLinesRegexp

public boolean getHeaderLinesRegexp()
Returns:
if lines in header file are regular expressions

isHeaderIgnoreLineNo

public boolean isHeaderIgnoreLineNo(int aLineNo)
Parameters:
aLineNo - a line number
Returns:
if aLineNo is one of the ignored header lines.

getCacheFile

public java.lang.String getCacheFile()
Returns:
the name of the cache file

setClassLoader

public void setClassLoader(java.lang.ClassLoader aLoader)
Set the class loader for locating classes.
Parameters:
aLoader - the class loader

setIllegalImports

public void setIllegalImports(java.lang.String aPkgPrefixList)
Parameters:
aPkgPrefixList - comma separated list of package prefixes

setIllegalInstantiations

public void setIllegalInstantiations(java.lang.String aClassList)
Parameters:
aClassList - comma separated list of fully qualified class names

setJavadocScope

public void setJavadocScope(Scope aJavadocScope)
Parameters:
aJavadocScope - visibility scope where Javadoc is checked

setBooleanProperty

public void setBooleanProperty(java.lang.String aName,
                               boolean aTo)
Set the boolean property.
Parameters:
aName - name of the property. Should be defined in Defn.
aTo - the value to set

setHeaderFile

public void setHeaderFile(java.lang.String aFileName)
                   throws java.io.FileNotFoundException,
                          java.io.IOException
Parameters:
aFileName - the header lines to check for
Throws:
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs

setHeaderIgnoreLines

public void setHeaderIgnoreLines(java.lang.String aList)
Parameters:
aList - comma separated list of line numbers to ignore in header.

setCacheFile

public void setCacheFile(java.lang.String aCacheFile)
Parameters:
aCacheFile - name of cache file

getLCurlyMethod

public LeftCurlyOption getLCurlyMethod()
Returns:
the left curly placement option for methods

getLCurlyType

public LeftCurlyOption getLCurlyType()
Returns:
the left curly placement option for types

getLCurlyOther

public LeftCurlyOption getLCurlyOther()
Returns:
the left curly placement option for others

getRCurly

public RightCurlyOption getRCurly()
Returns:
the right curly placement option

setRCurly

public void setRCurly(RightCurlyOption aTo)
Parameters:
aTo - set the right curly placement option

getTryBlock

public BlockOption getTryBlock()
Returns:
the try block option

getCatchBlock

public BlockOption getCatchBlock()
Returns:
the catch block option

getFinallyBlock

public BlockOption getFinallyBlock()
Returns:
the finally block option

getParenPadOption

public PadOption getParenPadOption()
Returns:
the parenthesis padding option

setParenPadOption

public void setParenPadOption(PadOption aTo)
Parameters:
aTo - set the parenthesis option

getWrapOpOption

public WrapOpOption getWrapOpOption()
Returns:
the wrapping on operator option

setWrapOpOption

public void setWrapOpOption(WrapOpOption aTo)
Parameters:
aTo - set the wrap on operator option

getBasedir

public java.lang.String getBasedir()
Returns:
the base directory

setBasedir

public void setBasedir(java.lang.String aTo)
Parameters:
aTo - sets the base directory

setIntProperty

public void setIntProperty(java.lang.String aName,
                           int aTo)
Set an integer property.
Parameters:
aName - name of the property to set
aTo - the value to set

setPatternProperty

public void setPatternProperty(java.lang.String aName,
                               java.lang.String aPat)
                        throws org.apache.regexp.RESyntaxException
Set an pattern property.
Parameters:
aName - name of the property to set
aPat - the value to set
Throws:
org.apache.regexp.RESyntaxException - if an error occurs

setBlockOptionProperty

public void setBlockOptionProperty(java.lang.String aName,
                                   BlockOption aTo)
Set an BlockOption property.
Parameters:
aName - name of the property to set
aTo - the value to set

setLeftCurlyOptionProperty

public void setLeftCurlyOptionProperty(java.lang.String aName,
                                       LeftCurlyOption aTo)
Set an LeftCurlyOption property.
Parameters:
aName - name of the property to set
aTo - the value to set