1 22 package org.aspectj.tools.ajdoc; 23 24 import org.aspectj.compiler.base.ast.ASTObject; 25 import org.aspectj.compiler.base.ast.CodeDec; 26 import org.aspectj.compiler.base.ast.Dec; 27 import org.aspectj.compiler.base.ast.DummySourceLocation; 28 import org.aspectj.compiler.base.ast.Formals; 29 import org.aspectj.compiler.base.ast.NameType; 30 import org.aspectj.compiler.base.ast.SourceLocation; 31 import org.aspectj.compiler.base.ast.TypeDec; 32 import org.aspectj.compiler.base.ast.TypeDs; 33 import org.aspectj.compiler.crosscuts.ast.AdviceDec; 34 35 import java.util.ArrayList ; 36 import java.util.Collection ; 37 import java.util.Collections ; 38 import java.util.Iterator ; 39 import java.util.List ; 40 import java.util.Set ; 41 42 public abstract class CodeDocImpl extends ExecutableMemberDocImpl { 43 44 45 private final CodeDec codeDec; 46 47 public CodeDocImpl(com.sun.javadoc.ClassDoc containingClass, CodeDec codeDec) { 48 super(containingClass); 49 this.codeDec = codeDec; 50 } 51 52 protected Collection createAdvice() { 53 Set affectedBy = ajc().getCorrespondences().getAffectedBy(codeDec()); 54 if (affectedBy.size() < 1) return Collections.EMPTY_LIST; 55 List list = new ArrayList (); 56 for (Iterator i = affectedBy.iterator(); i.hasNext();) { 57 AdviceDec adec = (AdviceDec)i.next(); 58 TypeDec owner = ((NameType)adec.getDeclaringType()).getTypeDec(); 59 AspectDocImpl ad = (AspectDocImpl)ClassDocImpl.getInstance(owner); 60 AdviceDocImpl adoc = ad.docForDec(adec); 61 list.add(adoc); 62 } 63 return list; 64 } 65 66 protected Dec dec() { 67 return codeDec(); 68 } 69 70 protected Formals getFormals() { 71 return codeDec().getFormals(); 72 } 73 74 protected TypeDs getThrows() { 75 return codeDec().getThrows(); 76 } 77 78 protected CodeDec codeDec() { 79 return codeDec; 80 } 81 } 82 83 | Popular Tags |