1 22 package org.aspectj.tools.doclets.standard; 23 24 import org.aspectj.tools.ajdoc.Access; 25 import org.aspectj.tools.ajdoc.Util; 26 27 import com.sun.javadoc.ClassDoc; 28 import com.sun.javadoc.PackageDoc; 29 import com.sun.tools.doclets.DirectoryManager; 30 import com.sun.tools.doclets.DocletAbortException; 31 32 import java.io.File ; 33 import java.io.IOException ; 34 import java.util.Map ; 35 36 41 public class ClassUseWriter 42 extends com.sun.tools.doclets.standard.ClassUseWriter 43 { 44 45 48 protected final ClassDoc classdoc; 49 50 53 protected final Map pkgToAdviceArgs; 54 55 58 protected final Map pkgToAdviceReturn; 59 60 63 protected final Map pkgToPointcutArgs; 64 65 68 protected final Map pkgToPointcutReturn; 69 70 73 protected final Map pkgToFieldIntroductions; 74 75 78 protected final Map pkgToClassIntroductions; 79 80 83 protected final Map pkgToInterfaceIntroductions; 84 85 88 protected final Map pkgToClassAdvisors; 89 90 94 protected final Map pkgToAspectDominatees; 95 96 100 protected final Map pkgToAspectDominators; 101 102 105 protected final MethodSubWriter methodSubWriter 106 = new MethodSubWriter(this); 107 108 111 protected final ConstructorSubWriter constrSubWriter 112 = new ConstructorSubWriter(this); 113 114 117 protected final FieldSubWriter fieldSubWriter 118 = new FieldSubWriter(this); 119 120 123 protected final ClassSubWriter classSubWriter 124 = new ClassSubWriter(this); 125 126 129 protected final PointcutSubWriter pointcutSubWriter 130 = new PointcutSubWriter(this); 131 132 135 protected final SuperIntroductionSubWriter superIntroductionSubWriter 136 = new SuperIntroductionSubWriter(this); 137 138 141 protected final FieldIntroductionSubWriter fieldIntroductionSubWriter 142 = new FieldIntroductionSubWriter(this); 143 144 147 protected final ConstructorIntroductionSubWriter constrIntroductionSubWriter 148 = new ConstructorIntroductionSubWriter(this); 149 150 153 protected final MethodIntroductionSubWriter methodIntroductionSubWriter 154 = new MethodIntroductionSubWriter(this); 155 156 159 protected final AdviceSubWriter adviceSubWriter 160 = new AdviceSubWriter(this); 161 162 163 164 public ClassUseWriter(ClassUseMapper mapper, 165 String path, 166 String filename, 167 String relpath, 168 ClassDoc classdoc) 169 throws IOException , DocletAbortException { 170 171 super(mapper.mapper(classdoc), path, 172 filename, relpath, classdoc); 173 174 mapper.restore(classdoc); 175 176 this.classdoc = Access.classdoc(this); 177 178 this.pkgToAdviceReturn = 179 _pkgDivide(mapper.classToAdviceReturn); 180 this.pkgToAdviceArgs = 181 _pkgDivide(mapper.classToAdviceArgs); 182 this.pkgToPointcutReturn = 183 _pkgDivide(mapper.classToPointcutReturn); 184 this.pkgToPointcutArgs = 185 _pkgDivide(mapper.classToPointcutArgs); 186 this.pkgToFieldIntroductions = 187 _pkgDivide(mapper.classToFieldIntroductions); 188 this.pkgToClassIntroductions = 189 _pkgDivide(mapper.classToClassIntroductions); 190 this.pkgToInterfaceIntroductions = 191 _pkgDivide(mapper.classToInterfaceIntroductions); 192 this.pkgToClassAdvisors = 193 _pkgDivide(mapper.classToAdvisors); 194 this.pkgToAspectDominatees = 195 _pkgDivide(mapper.classToDominatees); 196 this.pkgToAspectDominators = 197 _pkgDivide(mapper.classToDominators); 198 } 199 200 protected com.sun.tools.doclets.standard.ClassUseWriter 201 writer; 202 private Map _pkgDivide(Map classMap) { 203 return (Map )Util.invoke 204 (com.sun.tools.doclets.standard.ClassUseWriter.class, 205 this, "pkgDivide", 206 new Class []{java.util.Map .class}, 207 new Object []{classMap}); 208 } 209 210 public static void generate(ClassUseMapper mapper, 211 ClassDoc classdoc) 212 throws DocletAbortException { 213 ClassUseWriter cw = null; 214 String path = DirectoryManager.getDirectoryPath(classdoc. 215 containingPackage()); 216 if (path.length() > 0) { 217 path += File.separator; 218 } 219 path += "class-use"; 220 String filename = classdoc.name() + ".html"; 221 String pkgname = classdoc.containingPackage().name(); 222 pkgname += (pkgname.length() > 0 ? "." : "") + "class-use"; 223 String relpath = DirectoryManager.getRelativePath(pkgname); 224 try { 225 (cw = new ClassUseWriter(mapper, path, filename, 226 relpath, classdoc)). 227 generateClassUseFile(); 228 } catch (IOException e) { 229 Standard.configuration().standardmessage. 230 error("doclet.exception_encountered", e+"", filename); 231 throw new DocletAbortException(); 232 } finally { 233 if (cw != null) cw.close(); 234 } 235 } 236 237 protected void generateClassUse(PackageDoc pkg) throws IOException { 238 super.generateClassUse(pkg); 239 String classlink = getClassLink(classdoc); 240 String pkglink = getPackageLink(pkg); 241 242 printUseInfo(adviceSubWriter, pkgToAdviceReturn, 243 pkg, "AdviceReturn", classlink, pkglink); 244 printUseInfo(adviceSubWriter, pkgToAdviceArgs, 245 pkg, "AdviceArgs", classlink, pkglink); 246 printUseInfo(pointcutSubWriter, pkgToPointcutReturn, 247 pkg, "PointcutReturn", classlink, pkglink); 248 printUseInfo(pointcutSubWriter, pkgToPointcutArgs, 249 pkg, "PointcutArgs", classlink, pkglink); 250 printUseInfo(fieldIntroductionSubWriter, pkgToFieldIntroductions, 251 pkg, "FieldIntroductions", classlink, pkglink); 252 printUseInfo(superIntroductionSubWriter, pkgToClassIntroductions, 253 pkg, "ClassIntroductions", classlink, pkglink); 254 printUseInfo(superIntroductionSubWriter, pkgToInterfaceIntroductions, 255 pkg, "InterfaceIntroductions", classlink, pkglink); 256 printUseInfo(classSubWriter, pkgToClassAdvisors, 257 pkg, "ClassAdvisors", classlink, pkglink); 258 259 printUseInfo(classSubWriter, pkgToAspectDominatees, 260 pkg, "AspectDominatees", classlink, pkglink); 261 printUseInfo(classSubWriter, pkgToAspectDominators, 262 pkg, "AspectDominators", classlink, pkglink); 263 } 264 265 protected final void printUseInfo(AbstractSubWriter mw, Map map, 266 PackageDoc pkg, String kind, 267 String classlink, String pkglink) { 268 Access.printUseInfo(mw, map.get(pkg), 269 getText("doclet.ClassUse_" + kind, 270 classlink,pkglink)); 271 } 272 } 273 | Popular Tags |