Class ExcessivePublicCountRule

All Implemented Interfaces:
AstVisitor, JavaVisitor, Rule, PropertySource

public class ExcessivePublicCountRule extends net.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule<ASTTypeDeclaration>
Rule attempts to count all public methods and public attributes defined in a class.

If a class has a high number of public operations, it might be wise to consider whether it would be appropriate to divide it into subclasses.

A large proportion of public members and operations means the class has high potential to be affected by external classes. Furthermore, increased effort will be required to thoroughly test the class.

Author:
aglover
  • Constructor Details

    • ExcessivePublicCountRule

      public ExcessivePublicCountRule()
  • Method Details

    • defaultReportLevel

      protected int defaultReportLevel()
      Specified by:
      defaultReportLevel in class net.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule<ASTTypeDeclaration>
    • isViolation

      @Deprecated protected boolean isViolation(ASTTypeDeclaration node, int reportLevel)
      Deprecated.
      since 7.18.0. This method is not used anymore and shouldn't be implemented.
    • getMetric

      protected int getMetric(ASTTypeDeclaration node)
      Specified by:
      getMetric in class net.sourceforge.pmd.lang.java.rule.internal.AbstractJavaCounterCheckRule<ASTTypeDeclaration>