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 options:
ignoreOverridden - allows to skip methods with Override annotation from validation. Default values is false .
accessModifiers - access modifiers of methods which should to be checked. Default value is public, protected, package, private .
An example of how to configure the check:<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:
<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>
AutomaticBean.OutputStreamOptionsMSG_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 |
setAccessModifiers(AccessModifier... accessModifiers)
Sets access modifiers of methods which should be checked.
|
void |
setIgnoreOverridden(boolean ignoreOverridden)
Sets whether to skip methods with Override annotation from validation.
|
setFormat, visitTokenbeginTree, clearMessages, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setClassLoader, setFileContents, setTabWidth, setTokensfinishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityconfigure, contextualize, getConfiguration, setupChildpublic ParameterNameCheck()
ParameterNameCheck instance.public void setIgnoreOverridden(boolean ignoreOverridden)
ignoreOverridden - Flag for skipping methods with Override annotation.public void setAccessModifiers(AccessModifier... accessModifiers)
accessModifiers - access modifiers of methods which should be checked.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–2018. All rights reserved.