com.puppycrawl.tools.checkstyle.checks

Class AbstractFormatCheck

public abstract class AbstractFormatCheck extends Check

Abstract class for checks that verify strings using a java.util.regex.Pattern 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
StringgetFormat()
PatterngetRegexp()
voidsetCompileFlags(int aCompileFlags)
Set the compile flags for the regular expression.
voidsetFormat(String aFormat)
Set the format to the specified regular expression.

Constructor Detail

AbstractFormatCheck

public AbstractFormatCheck(String aDefaultFormat)
Creates a new AbstractFormatCheck instance. Defaults the compile flag to 0 (the default).

Parameters: aDefaultFormat default format

Throws: ConversionException unable to parse aDefaultFormat

AbstractFormatCheck

public AbstractFormatCheck(String aDefaultFormat, int aCompileFlags)
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: ConversionException unable to parse aDefaultFormat

Method Detail

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)
Set the format to the specified regular expression.

Parameters: aFormat a String value

Throws: ConversionException unable to parse aFormat