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.OutputStreamOptions
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 |
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, visitToken
beginTree, clearMessages, destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getMessages, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, log, setClassLoader, setFileContents, setTabWidth, setTokens
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverity
configure, contextualize, getConfiguration, setupChild
public 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()
AbstractCheck
getDefaultTokens
in class AbstractCheck
TokenTypes
public int[] getAcceptableTokens()
AbstractCheck
getAcceptableTokens
in class AbstractCheck
TokenTypes
public int[] getRequiredTokens()
AbstractCheck
getRequiredTokens
in class AbstractCheck
TokenTypes
protected boolean mustCheckName(DetailAST ast)
AbstractNameCheck
mustCheckName
in class AbstractNameCheck
ast
- the AST to check.Copyright © 2001–2018. All rights reserved.