public class RegexpCheck extends AbstractFormatCheck
A check that makes sure that a specified pattern exists (or not) in the file.
An example of how to configure the check to make sure a copyright statement is included in the file (but without requirements on where in the file it should be):
<module name="RequiredRegexp"> <property name="format" value="This code is copyrighted"/> </module>
And to make sure the same statement appears at the beginning of the file.
<module name="RequiredRegexp"> <property name="format" value="\AThis code is copyrighted"/> </module>
Constructor and Description |
---|
RegexpCheck()
Instantiates an new RegexpCheck.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTree(DetailAST aRootAST)
Called before the starting to process a tree.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
String |
getMessage()
Getter for message property.
|
void |
setDuplicateLimit(int aDuplicateLimit)
Sets the maximum number of instances of required pattern allowed.
|
void |
setErrorLimit(int aErrorLimit)
Sets the limit on the number of errors to report.
|
void |
setIgnoreComments(boolean aIgnoreComments)
Sets if matches within comments should be ignored.
|
void |
setIllegalPattern(boolean aIllegalPattern)
Sets if pattern is illegal, otherwise pattern is required.
|
void |
setMessage(String aMessage)
Setter for message property.
|
getFormat, getRegexp, setCompileFlags, setFormat
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public void setMessage(String aMessage)
aMessage
- custom message which should be used in report.public String getMessage()
public void setIgnoreComments(boolean aIgnoreComments)
aIgnoreComments
- True if comments should be ignored.public void setIllegalPattern(boolean aIllegalPattern)
aIllegalPattern
- True if pattern is not allowed.public void setErrorLimit(int aErrorLimit)
aErrorLimit
- the number of errors to report.public void setDuplicateLimit(int aDuplicateLimit)
aDuplicateLimit
- negative values mean no duplicate checking,
any positive value is used as the limit.public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
Copyright © 2001-2014. All Rights Reserved.