com.puppycrawl.tools.checkstyle.checks

Class AbstractFormatCheck

Implemented Interfaces:
Configurable, Contextualizable
Known Direct Subclasses:
AbstractClassNameCheck, AbstractNameCheck, GenericIllegalRegexpCheck, IllegalTypeCheck, MutableExceptionCheck, PackageNameCheck, RegexpCheck, RequiredRegexpCheck, ReturnCountCheck, 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

getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setId, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Constructor Details

AbstractFormatCheck

public AbstractFormatCheck(String aDefaultFormat)
            throws ConversionException
Creates a new AbstractFormatCheck instance. Defaults the compile flag to 0 (the default).
Parameters:
aDefaultFormat - default format

AbstractFormatCheck

public AbstractFormatCheck(String aDefaultFormat,
                           int aCompileFlags)
            throws 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)

Method Details

getFormat

public final String getFormat()
Returns:
the regexp format

getRegexp

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

setCompileFlags

public final void setCompileFlags(int aCompileFlags)
Set the compile flags for the regular expression.
Parameters:
aCompileFlags - the compile flags to use.

setFormat

public final void setFormat(String aFormat)
            throws ConversionException
Set the format to the specified regular expression.
Parameters:
aFormat - a String value