net.sourceforge.pmd.rules.design
Class GenericClassCounterRule

java.lang.Object
  extended by net.sourceforge.pmd.CommonAbstractRule
      extended by net.sourceforge.pmd.AbstractJavaRule
          extended by net.sourceforge.pmd.rules.design.GenericClassCounterRule
All Implemented Interfaces:
JavaParserVisitor, 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 interface net.sourceforge.pmd.Rule
LOWEST_PRIORITY, PRIORITIES
 
Constructor Summary
GenericClassCounterRule()
          Default empty constructor
 
Method Summary
 void end(RuleContext ctx)
          End processing.
protected  void init()
           
 void start(RuleContext ctx)
          Start processing.
 java.lang.Object visit(ASTClassOrInterfaceType classType, java.lang.Object data)
           
 java.lang.Object visit(ASTCompilationUnit node, java.lang.Object data)
           
 java.lang.Object visit(ASTImportDeclaration node, java.lang.Object data)
           
 
Methods inherited from class net.sourceforge.pmd.AbstractJavaRule
addViolation, addViolation, addViolation, addViolationWithMessage, 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.CommonAbstractRule
addExample, addProperties, addProperty, addRuleChainVisit, asFixedMap, asFixedMap, equals, getBooleanProperties, getBooleanProperty, getBooleanProperty, getDescription, getDoubleProperties, getDoubleProperty, getDoubleProperty, getExample, getExamples, getExternalInfoUrl, getIntProperties, getIntProperty, getIntProperty, getMessage, getName, getPriority, getPriorityName, getProperties, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, getStringProperties, getStringProperty, getStringProperty, getTypeProperties, getTypeProperty, hashCode, hasProperty, include, propertiesByName, propertyDescriptorFor, setDescription, setExternalInfoUrl, setInclude, setMessage, setName, setPriority, setProperties, setProperty, setRuleClass, setRuleSetName, setSince, setUsesDFA, setUsesTypeResolution, usesDFA, usesRuleChain, usesTypeResolution
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericClassCounterRule

public GenericClassCounterRule()
Default empty constructor

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 CommonAbstractRule

visit

public java.lang.Object visit(ASTCompilationUnit node,
                              java.lang.Object data)
Specified by:
visit in interface JavaParserVisitor
Overrides:
visit in class AbstractJavaRule

visit

public java.lang.Object visit(ASTImportDeclaration node,
                              java.lang.Object data)
Specified by:
visit in interface JavaParserVisitor
Overrides:
visit in class AbstractJavaRule

visit

public java.lang.Object visit(ASTClassOrInterfaceType classType,
                              java.lang.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 CommonAbstractRule


Copyright © 2002-2011 InfoEther. All Rights Reserved.