public class ParameterNumberCheck extends Check
Checks the number of parameters that a method or constructor has.
The default allowable number of parameters is 7.
To change the number of allowable parameters, set property max.
Allows to ignore number of parameters for methods with
@Override annotation.
An example of how to configure the check is:
<module name="ParameterNumber"/>
An example of how to configure the check to allow 10 parameters
and ignoring parameters for methods with @Override
annotation is:
<module name="ParameterNumber">
<property name="max" value="10"/>
<property name="ignoreOverriddenMethods" value="true"/>
</module>
Java code that will be ignored:
@Override
public void needsLotsOfParameters(int a,
int b, int c, int d, int e, int f, int g, int h) {
...
}
| Constructor and Description |
|---|
ParameterNumberCheck() |
| Modifier and Type | Method and Description |
|---|---|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
void |
setIgnoreOverriddenMethods(boolean aIgnoreOverriddenMethods)
Ignore number of parameters for methods with
@
Override annotation. |
void |
setMax(int aMax)
Sets the maximum number of allowed parameters.
|
void |
visitToken(DetailAST aAST)
Called to process a token.
|
beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokensgetCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverityconfigure, contextualize, finishLocalSetup, getConfiguration, setupChildpublic void setMax(int aMax)
aMax - the max allowed parameterspublic void setIgnoreOverriddenMethods(boolean aIgnoreOverriddenMethods)
Override annotation.aIgnoreOverriddenMethods - set ignore overridden methodspublic int[] getDefaultTokens()
CheckgetDefaultTokens in class CheckTokenTypespublic void visitToken(DetailAST aAST)
CheckvisitToken in class CheckaAST - the token to processCopyright © 2001-2014. All Rights Reserved.