View Javadoc
1 /*** 2 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html 3 */ 4 package net.sourceforge.pmd.rules; 5 6 import net.sourceforge.pmd.ast.ASTCompilationUnit; 7 import net.sourceforge.pmd.ast.ASTImportDeclaration; 8 import net.sourceforge.pmd.rules.design.ExcessiveNodeCountRule; 9 10 /*** 11 * ExcessiveImportsRule attempts to count all unique imports a class 12 * contains. This rule will count a "import com.something.*;" as a single 13 * import. This is a unqiue situation and I'd like to create an audit type 14 * rule that captures those. 15 * 16 * @since Feb 21, 2003 17 * @author aglover 18 * 19 */ 20 public class ExcessiveImportsRule extends ExcessiveNodeCountRule { 21 22 /*** 23 * Hook constructor to pass in parent type 24 */ 25 public ExcessiveImportsRule() { 26 super(ASTCompilationUnit.class); 27 } 28 29 /*** 30 * Hook method to count imports. This is a user defined value. 31 * @return Object 32 * @param ASTImportDeclaration node 33 * @param Object data 34 */ 35 public Object visit(ASTImportDeclaration node, Object data) { 36 return new Integer(1); 37 } 38 }

This page was automatically generated by Maven