public class ParameterNameCheck extends AbstractNameCheck
Checks that method and catch parameter names conform to a format specified
by the format property. The format is a
regular expression
and defaults to
^[a-z][a-zA-Z0-9]*$.
The check has the following option:
ignoreOverridden - allows to skip methods with Override annotation from validation. Default values is false .
An example of how to configure the check is:
<module name="ParameterName"/>
An example of how to configure the check for names that begin with a lower case letter, followed by letters, digits, and underscores is:
<module name="ParameterName">
<property name="format" value="^[a-z][_a-zA-Z0-9]+$"/>
</module>
An example of how to configure the check to skip methods with Override annotation from validation:
<module name="ParameterName">
<property name="ignoreOverridden" value="true"/>
</module>
MSG_INVALID_PATTERN| Constructor and Description |
|---|
ParameterNameCheck()
Creates a new
ParameterNameCheck instance. |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
protected boolean |
mustCheckName(DetailAST ast)
Decides whether the name of an AST should be checked against
the format regexp.
|
void |
setIgnoreOverridden(boolean ignoreOverridden)
Sets whether to skip methods with Override annotation from validation.
|
setFormat, visitTokenbeginTree, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokensgetCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverityconfigure, contextualize, finishLocalSetup, getConfiguration, setupChildpublic ParameterNameCheck()
ParameterNameCheck instance.public void setIgnoreOverridden(boolean ignoreOverridden)
ignoreOverridden - Flag for skipping methods with Override annotation.public int[] getDefaultTokens()
AbstractCheckgetDefaultTokens in class AbstractCheckTokenTypespublic int[] getAcceptableTokens()
AbstractCheckgetAcceptableTokens in class AbstractCheckTokenTypespublic int[] getRequiredTokens()
AbstractCheckgetRequiredTokens in class AbstractCheckTokenTypesprotected boolean mustCheckName(DetailAST ast)
AbstractNameCheckmustCheckName in class AbstractNameCheckast - the AST to check.Copyright © 2001-2016. All Rights Reserved.