com.puppycrawl.tools.checkstyle.checks.usage

Class OneMethodPrivateFieldCheck

Implemented Interfaces:
Configurable, Contextualizable

public class OneMethodPrivateFieldCheck
extends AbstractUsageCheck

Checks that a private field is used in more than one method, constructor, or initializer.

Rationale: a private field used in only one method, constructor, or initializer should be replaced by a local variable.

An example of how to configure the check is:

 <module name="usage.OneMethodPrivateField"/>
 

Author:
Rick Giles

Method Summary

void
applyTo(Set aNodes)
int[]
getDefaultTokens()
String
getErrorKey()
boolean
mustCheckReferenceCount(DetailAST aAST)

Methods inherited from class com.puppycrawl.tools.checkstyle.checks.usage.AbstractUsageCheck

applyTo, beginTree, finishTree, getASTManager, getErrorKey, getIgnoreFormat, getRegexp, logError, mustCheckReferenceCount, setIgnoreFormat, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check

beginTree, destroy, finishTree, getAcceptableTokens, getClassLoader, getDefaultTokens, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens, visitToken

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter

getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, log, log, setSeverity

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean

configure, contextualize, finishLocalSetup, getConfiguration, setupChild

Method Details

applyTo

public void applyTo(Set aNodes)
Overrides:
applyTo in interface AbstractUsageCheck

See Also:
AbstractUsageCheck


getDefaultTokens

public int[] getDefaultTokens()
Overrides:
getDefaultTokens in interface Check

See Also:
Check


getErrorKey

public String getErrorKey()
Overrides:
getErrorKey in interface AbstractUsageCheck

See Also:
AbstractUsageCheck


mustCheckReferenceCount

public boolean mustCheckReferenceCount(DetailAST aAST)
Overrides:
mustCheckReferenceCount in interface AbstractUsageCheck

See Also:
AbstractUsageCheck