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 rootAST)
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 duplicateLimit)
Sets the maximum number of instances of required pattern allowed.
|
void |
setErrorLimit(int errorLimit)
Sets the limit on the number of errors to report.
|
void |
setIgnoreComments(boolean ignoreComments)
Sets if matches within comments should be ignored.
|
void |
setIllegalPattern(boolean illegalPattern)
Sets if pattern is illegal, otherwise pattern is required.
|
void |
setMessage(String message)
Setter for message property.
|
getFormat, getRegexp, setCompileFlags, setFormatdestroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitTokengetCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverityconfigure, contextualize, finishLocalSetup, getConfiguration, setupChildpublic RegexpCheck()
public void setMessage(String message)
message - custom message which should be used in report.public String getMessage()
public void setIgnoreComments(boolean ignoreComments)
ignoreComments - True if comments should be ignored.public void setIllegalPattern(boolean illegalPattern)
illegalPattern - True if pattern is not allowed.public void setErrorLimit(int errorLimit)
errorLimit - the number of errors to report.public void setDuplicateLimit(int duplicateLimit)
duplicateLimit - negative values mean no duplicate checking,
any positive value is used as the limit.public int[] getDefaultTokens()
CheckgetDefaultTokens in class CheckTokenTypesCopyright © 2001–2015. All rights reserved.