com.puppycrawl.tools.checkstyle.checks
Class AbstractFormatCheck

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.Check
              extended by com.puppycrawl.tools.checkstyle.checks.AbstractFormatCheck
All Implemented Interfaces:
Configurable, Contextualizable
Direct Known Subclasses:
AbstractClassNameCheck, AbstractNameCheck, IllegalTokenTextCheck, IllegalTypeCheck, MutableExceptionCheck, PackageNameCheck, RegexpCheck, ReturnCountCheck, SuppressWarningsCheck, TodoCommentCheck, TrailingCommentCheck

public abstract class AbstractFormatCheck
extends Check

Abstract class for checks that verify strings using a regular expression. It provides support for setting the regular expression using the property name format.

Version:
1.0
Author:
Oliver Burn

Constructor Summary
AbstractFormatCheck(String aDefaultFormat)
          Creates a new AbstractFormatCheck instance.
AbstractFormatCheck(String aDefaultFormat, int aCompileFlags)
          Creates a new AbstractFormatCheck instance.
 
Method Summary
 String getFormat()
           
 Pattern getRegexp()
           
 void setCompileFlags(int aCompileFlags)
          Set the compile flags for the regular expression.
 void setFormat(String aFormat)
          Set the format to the specified regular expression.
 
Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, 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
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
 
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
 

Constructor Detail

AbstractFormatCheck

public AbstractFormatCheck(String aDefaultFormat)
                    throws org.apache.commons.beanutils.ConversionException
Creates a new AbstractFormatCheck instance. Defaults the compile flag to 0 (the default).

Parameters:
aDefaultFormat - default format
Throws:
org.apache.commons.beanutils.ConversionException - unable to parse aDefaultFormat

AbstractFormatCheck

public AbstractFormatCheck(String aDefaultFormat,
                           int aCompileFlags)
                    throws org.apache.commons.beanutils.ConversionException
Creates a new AbstractFormatCheck instance.

Parameters:
aDefaultFormat - default format
aCompileFlags - the Pattern flags to compile the regexp with. See Pattern.compile(java.lang.String, int)
Throws:
org.apache.commons.beanutils.ConversionException - unable to parse aDefaultFormat
Method Detail

setFormat

public final void setFormat(String aFormat)
                     throws org.apache.commons.beanutils.ConversionException
Set the format to the specified regular expression.

Parameters:
aFormat - a String value
Throws:
org.apache.commons.beanutils.ConversionException - unable to parse aFormat

setCompileFlags

public final void setCompileFlags(int aCompileFlags)
Set the compile flags for the regular expression.

Parameters:
aCompileFlags - the compile flags to use.

getRegexp

public final Pattern getRegexp()
Returns:
the regexp to match against

getFormat

public final String getFormat()
Returns:
the regexp format


Copyright © 2001-2011. All Rights Reserved.