net.sourceforge.pmd.lang.java.rule.design

## Class GenericClassCounterRule

- java.lang.Object
- - net.sourceforge.pmd.AbstractPropertySource
  - - net.sourceforge.pmd.lang.rule.AbstractRule
    - - net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
      - - net.sourceforge.pmd.lang.java.rule.design.GenericClassCounterRule

- All Implemented Interfaces:
    JavaParserVisitor, ImmutableLanguage, PropertySource, Rule

      public class GenericClassCounterRule
      extends AbstractJavaRule

  A generic rule that can be configured to "count" classes of certain type based on either their name (full name, prefix, suffixes anything can be matched with a regex), and/or their type.

  Example of configurations:

  Author:
    Ryan Gutafson, rgustav@users.sourceforge.net, Romain PELISSE, belaran@gmail.com

- - ### Field Summary

    - ### Fields inherited from class net.sourceforge.pmd.AbstractPropertySource

      `propertyDescriptors, propertyValuesByDescriptor`

    - ### Fields inherited from interface net.sourceforge.pmd.Rule

      `VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericClassCounterRule()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `end(RuleContext ctx)` End processing.
    `protected void` | `init()`
    `void` | `start(RuleContext ctx)` Start processing.
    `Object` | `visit(ASTClassOrInterfaceType classType, Object data)`
    `Object` | `visit(ASTCompilationUnit node, Object data)`
    `Object` | `visit(ASTImportDeclaration node, Object data)`

    - ### Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRule

      `apply, getDeclaringType, importsPackage, isQualifiedName, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAll`

    - ### Methods inherited from class net.sourceforge.pmd.lang.rule.AbstractRule

      `addExample, addRuleChainVisit, addRuleChainVisit, addViolation, addViolation, addViolation, addViolationWithMessage, addViolationWithMessage, addViolationWithMessage, deepCopyValuesTo, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, hashCode, isDeprecated, setDeprecated, setDescription, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setName, setPriority, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, usesDFA, usesRuleChain, usesTypeResolution`

    - ### Methods inherited from class net.sourceforge.pmd.AbstractPropertySource

      `copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sourceforge.pmd.PropertySource

      `definePropertyDescriptor, dysfunctionReason, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, setProperty, useDefaultValueFor, usesDefaultValues`

- - ### Constructor Detail

    - #### GenericClassCounterRule

          public GenericClassCounterRule()

  - ### Method Detail

    - #### init

          protected void init()

    - #### start

          public void start(RuleContext ctx)

      Description copied from interface: `Rule`
      Start processing. Called once, before apply() is first called.
      Specified by:
        `start` in interface `Rule`
      Overrides:
        `start` in class `AbstractRule`
      See Also:
        `Rule.start(RuleContext)`

    - #### visit

          public Object visit(ASTCompilationUnit node,
                     Object data)

      Specified by:
        `visit` in interface `JavaParserVisitor`
      Overrides:
        `visit` in class `AbstractJavaRule`

    - #### visit

          public Object visit(ASTImportDeclaration node,
                     Object data)

      Specified by:
        `visit` in interface `JavaParserVisitor`
      Overrides:
        `visit` in class `AbstractJavaRule`

    - #### visit

          public Object visit(ASTClassOrInterfaceType classType,
                     Object data)

      Specified by:
        `visit` in interface `JavaParserVisitor`
      Overrides:
        `visit` in class `AbstractJavaRule`

    - #### end

          public void end(RuleContext ctx)

      Description copied from interface: `Rule`
      End processing. Called once, after apply() is last called.
      Specified by:
        `end` in interface `Rule`
      Overrides:
        `end` in class `AbstractRule`
      See Also:
        `Rule.end(RuleContext)`

Copyright © 2002-2013 InfoEther. All Rights Reserved.