com.puppycrawl.tools.checkstyle.checks.usage

Class AbstractUsageCheck

Implemented Interfaces:
Configurable, Contextualizable
Known Direct Subclasses:
OneMethodPrivateFieldCheck, UnusedLocalVariableCheck, UnusedParameterCheck, UnusedPrivateFieldCheck, UnusedPrivateMethodCheck

public abstract class AbstractUsageCheck
extends Check

Performs a usage check for fields, methods, parameters, variables.

Author:
Rick Giles

Constructor Summary

AbstractUsageCheck()
Constructs an AbstractUsageCheck.

Method Summary

void
applyTo(Set aNodes)
Applies this check to a set of nodes.
void
beginTree(DetailAST aRootAST)
void
finishTree(DetailAST aAST)
protected com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.ASTManager
getASTManager()
Gets the manager for AST nodes.
String
getErrorKey()
Returns the key for the Checkstyle error message.
String
getIgnoreFormat()
RE
getRegexp()
void
logError(Exception aException)
Logs an exception.
boolean
mustCheckReferenceCount(DetailAST aAST)
Determines whether the reference count of an aAST is required.
void
setIgnoreFormat(String aFormat)
Set the ignore format to the specified regular expression.
void
visitToken(DetailAST aAST)

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

Constructor Details

AbstractUsageCheck

public AbstractUsageCheck()
Constructs an AbstractUsageCheck.

Method Details

applyTo

public void applyTo(Set aNodes)
Applies this check to a set of nodes.

Parameters:
aNodes - the nodes to check.


beginTree

public void beginTree(DetailAST aRootAST)
Overrides:
beginTree in interface Check

See Also:
Check


finishTree

public void finishTree(DetailAST aAST)
Overrides:
finishTree in interface Check

See Also:
Check


getASTManager

protected com.puppycrawl.tools.checkstyle.checks.usage.transmogrify.ASTManager getASTManager()
Gets the manager for AST nodes.

Returns:
the AST manager.


getErrorKey

public String getErrorKey()
Returns the key for the Checkstyle error message.

Returns:
the key for the Checkstyle error message.


getIgnoreFormat

public String getIgnoreFormat()

Returns:
the regexp format


getRegexp

public RE getRegexp()

Returns:
the regexp to match against


logError

public void logError(Exception aException)
Logs an exception.

Parameters:
aException - the exception to log.


mustCheckReferenceCount

public boolean mustCheckReferenceCount(DetailAST aAST)
Determines whether the reference count of an aAST is required.

Parameters:
aAST - the node to check.

Returns:
true if the reference count of aAST is required.


setIgnoreFormat

public void setIgnoreFormat(String aFormat)
            throws ConversionException
Set the ignore format to the specified regular expression.

Parameters:
aFormat - a String value


visitToken

public void visitToken(DetailAST aAST)
Overrides:
visitToken in interface Check

See Also:
Check