## com.puppycrawl.tools.checkstyle.checks.metrics
Class AbstractClassCouplingCheck

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.AutomaticBean
          com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
              com.puppycrawl.tools.checkstyle.api.Check
                  com.puppycrawl.tools.checkstyle.checks.metrics.AbstractClassCouplingCheck

All Implemented Interfaces:
  Configurable, Contextualizable

Direct Known Subclasses:
  ClassDataAbstractionCouplingCheck, ClassFanOutComplexityCheck

    public abstract class AbstractClassCouplingCheck

extends Check

Base class for coupling calculation.

Author:
  Simon Harris, o_sukhodolsky

Constructor Summary
`protected` `AbstractClassCouplingCheck(int aDefaultMax)` Creates new instance of the check.

Method Summary
`void` `beginTree(DetailAST aAST)` Called before the starting to process a tree.
`int[]` `getDefaultTokens()` Returns the default token a check is interested in.
`protected abstract String` `getLogMessageId()`
`int` `getMax()`
`void` `leaveToken(DetailAST aAST)` Called after all the child nodes have been process.
`void` `setMax(int aMax)` Sets maximul allowed complexity.
`void` `visitToken(DetailAST aAST)` Called to process a token.

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
`destroy, finishTree, getAcceptableTokens, getClassLoader, getFileContents, getLines, getRequiredTokens, getTabWidth, getTokenNames, init, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
`getId, getMessageBundle, getSeverity, getSeverityLevel, log, log, log, log, log, log, log, log, log, setId, setSeverity`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, finishLocalSetup, getConfiguration, setupChild`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractClassCouplingCheck

    protected AbstractClassCouplingCheck(int aDefaultMax)

  Creates new instance of the check.

  Parameters:
    `aDefaultMax` - default value for allowed complexity.

Method Detail

### getDefaultTokens

    public final int[] getDefaultTokens()

  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 class `Check`
  Returns:
    the default tokens
  See Also:
    `TokenTypes`

### getMax

    public final int getMax()

  Returns:
    allowed complexity.

### setMax

    public final void setMax(int aMax)

  Sets maximul allowed complexity.

  Parameters:
    `aMax` - allowed complexity.

### beginTree

    public final void beginTree(DetailAST aAST)

  Called before the starting to process a tree. Ideal place to initialise information that is to be collected whilst processing a tree.

  Overrides:
    `beginTree` in class `Check`
  Parameters:
    `aAST` - the root of the tree

### getLogMessageId

    protected abstract String getLogMessageId()

  Returns:
    message key we use for log violations.

### visitToken

    public void visitToken(DetailAST aAST)

  Called to process a token.

  Overrides:
    `visitToken` in class `Check`
  Parameters:
    `aAST` - the token to process

### leaveToken

    public void leaveToken(DetailAST aAST)

  Called after all the child nodes have been process.

  Overrides:
    `leaveToken` in class `Check`
  Parameters:
    `aAST` - the token leaving

Back to the Checkstyle Home Page