public class HiddenFieldCheck extends Check
Checks that a local variable or a parameter does not shadow a field that is defined in the same class.
An example of how to configure the check is:
<module name="HiddenField"/>
An example of how to configure the check so that it checks variables but not parameters is:
<module name="HiddenField">
<property name="tokens" value="VARIABLE_DEF"/>
</module>
An example of how to configure the check so that it ignores the parameter of a setter method is:
<module name="HiddenField">
<property name="ignoreSetter" value="true"/>
</module>
An example of how to configure the check so that it ignores constructor parameters is:
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
</module>
| Constructor and Description |
|---|
HiddenFieldCheck() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginTree(DetailAST aRootAST)
Called before the starting to process a tree.
|
int[] |
getAcceptableTokens()
The configurable token set.
|
int[] |
getDefaultTokens()
Returns the default token a check is interested in.
|
Pattern |
getRegexp() |
int[] |
getRequiredTokens()
The tokens that this check must be registered for.
|
void |
leaveToken(DetailAST aAST)
Called after all the child nodes have been process.
|
void |
setIgnoreAbstractMethods(boolean aIgnoreAbstractMethods)
Set whether to ignore parameters of abstract methods.
|
void |
setIgnoreConstructorParameter(boolean aIgnoreConstructorParameter)
Set whether to ignore constructor parameters.
|
void |
setIgnoreFormat(String aFormat)
Set the ignore format to the specified regular expression.
|
void |
setIgnoreSetter(boolean aIgnoreSetter)
Set whether to ignore the parameter of a property setter method.
|
void |
visitToken(DetailAST aAST)
Called to process a token.
|
destroy, finishTree, getClassLoader, getFileContents, getLine, getLines, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokensgetCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverityconfigure, contextualize, finishLocalSetup, getConfiguration, setupChildpublic int[] getDefaultTokens()
CheckgetDefaultTokens in class CheckTokenTypespublic int[] getAcceptableTokens()
CheckgetAcceptableTokens in class CheckTokenTypespublic int[] getRequiredTokens()
CheckgetRequiredTokens in class CheckTokenTypespublic void beginTree(DetailAST aRootAST)
Checkpublic void visitToken(DetailAST aAST)
CheckvisitToken in class CheckaAST - the token to processpublic void leaveToken(DetailAST aAST)
CheckleaveToken in class CheckaAST - the token leavingpublic void setIgnoreFormat(String aFormat) throws org.apache.commons.beanutils.ConversionException
aFormat - a String valueorg.apache.commons.beanutils.ConversionException - unable to parse aFormatpublic void setIgnoreSetter(boolean aIgnoreSetter)
aIgnoreSetter - decide whether to ignore the parameter of
a property setter method.public void setIgnoreConstructorParameter(boolean aIgnoreConstructorParameter)
aIgnoreConstructorParameter - decide whether to ignore
constructor parameters.public void setIgnoreAbstractMethods(boolean aIgnoreAbstractMethods)
aIgnoreAbstractMethods - decide whether to ignore
parameters of abstract methods.public Pattern getRegexp()
Copyright © 2001-2014. All Rights Reserved.