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, getLines, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
public int[] getDefaultTokens()
Check
getDefaultTokens
in class Check
TokenTypes
public int[] getAcceptableTokens()
Check
getAcceptableTokens
in class Check
TokenTypes
public int[] getRequiredTokens()
Check
getRequiredTokens
in class Check
TokenTypes
public void beginTree(DetailAST aRootAST)
Check
public void visitToken(DetailAST aAST)
Check
visitToken
in class Check
aAST
- the token to processpublic void leaveToken(DetailAST aAST)
Check
leaveToken
in class Check
aAST
- 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.