KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > incava > doctorj > CtorDocAnalyzer


1 package org.incava.doctorj;
2
3 import java.util.Iterator JavaDoc;
4 import java.util.List JavaDoc;
5 import net.sourceforge.pmd.ast.*;
6 import org.incava.analysis.Report;
7 import org.incava.java.CtorUtil;
8 import org.incava.java.SimpleNodeUtil;
9 import org.incava.javadoc.JavadocNode;
10
11
12 /**
13  * Analyzes Javadoc and code for constructors.
14  */

15 public class CtorDocAnalyzer extends FunctionDocAnalyzer
16 {
17     private ASTConstructorDeclaration _ctor;
18     
19     public CtorDocAnalyzer(Report r, ASTConstructorDeclaration ctor)
20     {
21         super(r, ctor);
22         
23         _ctor = ctor;
24     }
25
26     public String JavaDoc getItemType()
27     {
28         return "constructor";
29     }
30
31     /**
32      * Returns the throws list for the constructor.
33      */

34     protected ASTFormalParameters getParameterList()
35     {
36         return CtorUtil.getParameters(_ctor);
37     }
38
39     /**
40      * Returns the valid tags, as strings, for ctors.
41      */

42     protected List JavaDoc getValidTags()
43     {
44         return JavadocTags.getValidConstructorTags();
45     }
46
47     /**
48      * Adds a violation for a constructor, with the violation pointing to the
49      * constructor name.
50      */

51     protected void addUndocumentedViolation(String JavaDoc desc)
52     {
53         Token nameTk = CtorUtil.getName(_ctor);
54         addViolation(desc, nameTk);
55     }
56
57     protected SimpleNode getEnclosingNode()
58     {
59         return SimpleNodeUtil.getParent( _ctor);
60     }
61
62 }
63
Popular Tags