Class AbstractClassCouplingCheck
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.api.AutomaticBean
-
- com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
-
- com.puppycrawl.tools.checkstyle.api.AbstractCheck
-
- com.puppycrawl.tools.checkstyle.checks.metrics.AbstractClassCouplingCheck
-
- All Implemented Interfaces:
Configurable
,Contextualizable
- Direct Known Subclasses:
ClassDataAbstractionCouplingCheck
,ClassFanOutComplexityCheck
public abstract class AbstractClassCouplingCheck extends AbstractCheck
Base class for coupling calculation.- Author:
- Simon Harris, o_sukhodolsky
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractClassCouplingCheck(int defaultMax)
Creates new instance of the check.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
beginTree(DetailAST ast)
Called before the starting to process a tree.int[]
getDefaultTokens()
Returns the default token a check is interested in.protected abstract String
getLogMessageId()
Returns message key we use for log violations.int
getMax()
Returns allowed complexity.void
leaveToken(DetailAST ast)
Called after all the child nodes have been process.void
setExcludeClassesRegexps(String... from)
Sets user-excluded regular expression of classes to ignore.void
setExcludedClasses(String... excludedClasses)
Sets user-excluded classes to ignore.void
setExcludedPackages(String... excludedPackages)
Sets user-excluded pakcages to ignore.void
setMax(int max)
Sets maximum allowed complexity.void
visitToken(DetailAST ast)
Called to process a token.-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLine, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity
-
Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, finishLocalSetup, getConfiguration, setupChild
-
-
-
-
Constructor Detail
-
AbstractClassCouplingCheck
protected AbstractClassCouplingCheck(int defaultMax)
Creates new instance of the check.- Parameters:
defaultMax
- default value for allowed complexity.
-
-
Method Detail
-
getLogMessageId
protected abstract String getLogMessageId()
Returns message key we use for log violations.- Returns:
- message key we use for log violations.
-
getDefaultTokens
public final int[] getDefaultTokens()
Description copied from class:AbstractCheck
Returns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.- Specified by:
getDefaultTokens
in classAbstractCheck
- Returns:
- the default tokens
- See Also:
TokenTypes
-
getMax
public final int getMax()
Returns allowed complexity.- Returns:
- allowed complexity.
-
setMax
public final void setMax(int max)
Sets maximum allowed complexity.- Parameters:
max
- allowed complexity.
-
setExcludedClasses
public final void setExcludedClasses(String... excludedClasses)
Sets user-excluded classes to ignore.- Parameters:
excludedClasses
- the list of classes to ignore.
-
setExcludeClassesRegexps
public void setExcludeClassesRegexps(String... from)
Sets user-excluded regular expression of classes to ignore.- Parameters:
from
- array representing regular expressions of classes to ignore.
-
setExcludedPackages
public final void setExcludedPackages(String... excludedPackages)
Sets user-excluded pakcages to ignore. All exlcuded packages should end with a period, so it also appends a dot to a package name.- Parameters:
excludedPackages
- the list of packages to ignore.
-
beginTree
public final void beginTree(DetailAST ast)
Description copied from class:AbstractCheck
Called before the starting to process a tree. Ideal place to initialize information that is to be collected whilst processing a tree.- Overrides:
beginTree
in classAbstractCheck
- Parameters:
ast
- the root of the tree
-
visitToken
public void visitToken(DetailAST ast)
Description copied from class:AbstractCheck
Called to process a token.- Overrides:
visitToken
in classAbstractCheck
- Parameters:
ast
- the token to process
-
leaveToken
public void leaveToken(DetailAST ast)
Description copied from class:AbstractCheck
Called after all the child nodes have been process.- Overrides:
leaveToken
in classAbstractCheck
- Parameters:
ast
- the token leaving
-
-