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

## Class GodClassRule

- 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.GodClassRule

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

      public class GodClassRule
      extends AbstractJavaRule

  The God Class Rule detects a the God Class design flaw using metrics. A god class does too many things, is very big and complex. It should be split apart to be more object-oriented. The rule uses the detection strategy described in [1]. The violations are reported against the entire class. [1] Lanza. Object-Oriented Metrics in Practice. Page 80.
  Since:
    5.0

- - ### 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
    `GodClassRule()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Object` | `visit(ASTCatchStatement node, Object data)`
    `Object` | `visit(ASTCompilationUnit node, Object data)` Base entry point for the visitor - the compilation unit (everything within one file).
    `Object` | `visit(ASTConditionalAndExpression node, Object data)`
    `Object` | `visit(ASTConditionalExpression node, Object data)`
    `Object` | `visit(ASTConditionalOrExpression node, Object data)`
    `Object` | `visit(ASTForStatement node, Object data)`
    `Object` | `visit(ASTIfStatement node, Object data)`
    `Object` | `visit(ASTMethodDeclaration node, Object data)`
    `Object` | `visit(ASTPrimaryExpression node, Object data)` The primary expression node is used to detect access to attributes and method calls.
    `Object` | `visit(ASTSwitchLabel node, Object data)`
    `Object` | `visit(ASTWhileStatement 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, visitAll`

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

      `addExample, addRuleChainVisit, addRuleChainVisit, addViolation, addViolation, addViolation, addViolationWithMessage, addViolationWithMessage, addViolationWithMessage, deepCopyValuesTo, end, 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, start, 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

    - #### GodClassRule

          public GodClassRule()

  - ### Method Detail

    - #### visit

          public Object visit(ASTCompilationUnit node,
                     Object data)

      Base entry point for the visitor - the compilation unit (everything within one file). The metrics are initialized. Then the other nodes are visited. Afterwards the metrics are evaluated against fixed thresholds.
      Specified by:
        `visit` in interface `JavaParserVisitor`
      Overrides:
        `visit` in class `AbstractJavaRule`

    - #### visit

          public Object visit(ASTPrimaryExpression node,
                     Object data)

      The primary expression node is used to detect access to attributes and method calls. If the access is not for a foreign class, then the `methodAttributeAccess` map is updated for the current method.
      Specified by:
        `visit` in interface `JavaParserVisitor`
      Overrides:
        `visit` in class `AbstractJavaRule`

    - #### visit

          public Object visit(ASTMethodDeclaration node,
                     Object data)

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

    - #### visit

          public Object visit(ASTConditionalOrExpression node,
                     Object data)

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

    - #### visit

          public Object visit(ASTConditionalAndExpression node,
                     Object data)

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

    - #### visit

          public Object visit(ASTIfStatement node,
                     Object data)

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

    - #### visit

          public Object visit(ASTWhileStatement node,
                     Object data)

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

    - #### visit

          public Object visit(ASTForStatement node,
                     Object data)

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

    - #### visit

          public Object visit(ASTSwitchLabel node,
                     Object data)

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

    - #### visit

          public Object visit(ASTCatchStatement node,
                     Object data)

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

    - #### visit

          public Object visit(ASTConditionalExpression node,
                     Object data)

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

Copyright © 2002-2013 InfoEther. All Rights Reserved.