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
Base class for coupling calculation.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
AutomaticBean.OutputStreamOptions -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractClassCouplingCheck(int defaultMax) Creates new instance of the check. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidCalled before the starting to process a tree.final int[]Returns the default token a check is interested in.protected abstract StringReturns message key we use for log violations.voidleaveToken(DetailAST ast) Called after all the child nodes have been process.voidsetExcludeClassesRegexps(String... from) Setter to specify user-configured regular expressions to ignore classes.final voidsetExcludedClasses(String... excludedClasses) Setter to specify user-configured class names to ignore.final voidsetExcludedPackages(String... excludedPackages) Setter to specify user-configured packages to ignore.final voidsetMax(int max) Setter to specify the maximum threshold allowed.voidvisitToken(DetailAST ast) Called to process a token.Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractCheck
clearMessages, destroy, finishTree, getAcceptableTokens, getFileContents, getLine, getLines, getMessages, getRequiredTokens, getTabWidth, getTokenNames, init, isCommentNodesRequired, log, log, log, setFileContents, setTabWidth, setTokensMethods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
finishLocalSetup, getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, setId, setSeverityMethods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
configure, contextualize, getConfiguration, setupChild
-
Constructor Details
-
AbstractClassCouplingCheck
protected AbstractClassCouplingCheck(int defaultMax) Creates new instance of the check.- Parameters:
defaultMax- default value for allowed complexity.
-
-
Method Details
-
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:AbstractCheckReturns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.- Specified by:
getDefaultTokensin classAbstractCheck- Returns:
- the default tokens
- See Also:
-
setMax
public final void setMax(int max) Setter to specify the maximum threshold allowed.- Parameters:
max- allowed complexity.
-
setExcludedClasses
Setter to specify user-configured class names to ignore.- Parameters:
excludedClasses- the list of classes to ignore.
-
setExcludeClassesRegexps
Setter to specify user-configured regular expressions to ignore classes.- Parameters:
from- array representing regular expressions of classes to ignore.
-
setExcludedPackages
Setter to specify user-configured packages to ignore. All excluded 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
Description copied from class:AbstractCheckCalled before the starting to process a tree. Ideal place to initialize information that is to be collected whilst processing a tree.- Overrides:
beginTreein classAbstractCheck- Parameters:
ast- the root of the tree
-
visitToken
Description copied from class:AbstractCheckCalled to process a token.- Overrides:
visitTokenin classAbstractCheck- Parameters:
ast- the token to process
-
leaveToken
Description copied from class:AbstractCheckCalled after all the child nodes have been process.- Overrides:
leaveTokenin classAbstractCheck- Parameters:
ast- the token leaving
-