1 22 package org.aspectj.tools.doclets.standard; 23 import org.aspectj.ajdoc.PointcutDoc; 24 25 import com.sun.javadoc.ClassDoc; 26 import com.sun.javadoc.MemberDoc; 27 import com.sun.javadoc.ParamTag; 28 import com.sun.javadoc.Parameter; 29 import com.sun.javadoc.ProgramElementDoc; 30 import com.sun.javadoc.SeeTag; 31 import com.sun.javadoc.Tag; 32 import com.sun.javadoc.Type; 33 import com.sun.tools.doclets.Util; 34 35 import java.util.List ; 36 37 public class PointcutSubWriter extends AbstractSubWriter { 38 39 protected Class delegateClass() { 40 return null; 41 } 42 43 public PointcutSubWriter 44 (com.sun.tools.doclets.standard.SubWriterHolderWriter writer, 45 ClassDoc classdoc) 46 { 47 super(writer, classdoc); 48 } 49 50 public PointcutSubWriter 51 (com.sun.tools.doclets.standard.SubWriterHolderWriter writer) 52 { 53 super(writer); 54 } 55 56 protected final String keyName() { return "Pointcut"; } 57 58 62 71 void printSignature(MemberDoc member) { 72 PointcutDoc pcd = (PointcutDoc)member; 73 writer.displayLength = 0; 74 writer.pre(); 75 printModifiers(pcd); 76 bold(pcd.name()); 77 printParameters(pcd); 78 printResultType(pcd); 79 writer.preEnd(); 80 } 81 82 void printResultType(PointcutDoc pcd) { 83 Type result = pcd.resultType(); 84 if (result != null) { 85 writer.code(); 86 print(" returns "); 87 printTypeLink(result); 88 writer.codeEnd(); 89 } 90 } 91 92 protected void printSummaryLink(ClassDoc cd, ProgramElementDoc member) { 93 PointcutDoc pcd = (PointcutDoc)member; 94 String name = member.name(); 95 writer.bold(); 96 writer.printClassLink(cd, name + pcd.signature(), name, false); 97 writer.boldEnd(); 98 writer.displayLength = name.length(); 99 printParameters(pcd); 100 printResultType(pcd); 101 102 } 103 104 protected void printInheritedSummaryLink(ClassDoc cd, 105 ProgramElementDoc member) { 106 PointcutDoc pcd = (PointcutDoc)member; 107 String name = member.name(); 108 writer.printClassLink(cd, name + pcd.signature(), name, false); 109 } 110 111 protected void printSummaryType(ProgramElementDoc member) { 112 PointcutDoc pcd = (PointcutDoc)member; 113 writer.printTypeSummaryHeader(); 114 printModifier(pcd); 115 writer.printTypeSummaryFooter(); 116 117 } 118 119 protected void printBodyHtmlEnd(ClassDoc cd) { 120 } 121 122 protected void nonfinalPrintMember(ProgramElementDoc member) { 123 PointcutDoc pcd = (PointcutDoc)member; 124 writer.anchor(pcd.name() + pcd.signature()); 125 printHead(pcd); 126 printSignature(pcd); 127 printFullComment(pcd); 128 } 129 130 protected void printDeprecatedLink(ProgramElementDoc member) { 131 writer.printClassLink(member.containingClass(), 132 member.name(), 133 ((PointcutDoc)member).qualifiedName()); 134 } 135 136 protected List getMembers(ClassDoc cd) { 137 return Util.asList(((org.aspectj.ajdoc.ClassDoc)cd).pointcuts()); 138 } 139 140 protected void printParameters(PointcutDoc member) { 141 print('('); 142 Parameter[] params = member.parameters(); 143 for (int i = 0; i < params.length; i++) { 144 printParam(params[i]); 145 if (i < params.length-1) { 146 writer.print(','); 147 writer.print(' '); 148 } 149 } 150 writer.print(')'); 151 } 152 153 protected void printParam(Parameter param) { 154 printTypedName(param.type(), param.name()); 155 } 156 157 protected void printParamTags(ParamTag[] params) { 158 if (params.length > 0) { 159 writer.dt(); 160 writer.boldText("doclet.Parameters"); 161 for (int i = 0; i < params.length; ++i) { 162 ParamTag pt = params[i]; 163 writer.dd(); 164 writer.code(); 165 print(pt.parameterName()); 166 writer.codeEnd(); 167 print(" - "); 168 writer.printInlineComment(pt); 169 } 170 } 171 } 172 173 protected void printReturnTag(Tag[] returnsTag) { 174 if (returnsTag.length > 0) { 175 writer.dt(); 176 writer.boldText("doclet.Returns"); 177 writer.dd(); 178 writer.printInlineComment(returnsTag[0]); 179 } 180 } 181 182 protected void printOverridden(ClassDoc overridden, PointcutDoc pcd) { 183 if (overridden != null) { 184 String name = pcd.name(); 185 writer.dt(); 186 writer.boldText("doclet.Overrides"); 187 writer.dd(); 188 writer.printText("doclet.in_class", 189 writer.codeText 190 (writer.getClassLink(overridden, 191 name + pcd.signature(), 192 name, false)), 193 writer.codeText 194 (writer.getClassLink(overridden))); 195 } 196 } 197 198 protected void printTags(ProgramElementDoc member) { 199 PointcutDoc pcd = (PointcutDoc)member; 200 ParamTag[] params = pcd.paramTags(); 201 Tag[] returnsTag = pcd.tags("return"); 202 Tag[] sinces = pcd.tags("since"); 203 SeeTag[] sees = pcd.seeTags(); 204 ClassDoc[] intfacs = member.containingClass().interfaces(); 205 ClassDoc overridden = pcd.overriddenClass(); 206 if (intfacs.length > 0 || overridden != null) { 207 writer.dd(); 208 writer.dl(); 209 printOverridden(overridden, pcd); 210 writer.dlEnd(); 211 writer.ddEnd(); 212 } 213 if (params.length + 214 returnsTag.length + 215 sinces.length + 216 sees.length > 0) { 217 writer.dd(); 218 writer.dl(); 219 printParamTags(params); 220 printReturnTag(returnsTag); 221 writer.printSinceTag(pcd); 222 writer.printSeeTags(pcd); 223 writer.dlEnd(); 224 writer.ddEnd(); 225 } 226 } 227 } 228 | Popular Tags |