KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > tools > ajdoc > CodeDocImpl


1 /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the debugger and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  */

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 JavaDoc;
36 import java.util.Collection JavaDoc;
37 import java.util.Collections JavaDoc;
38 import java.util.Iterator JavaDoc;
39 import java.util.List JavaDoc;
40 import java.util.Set JavaDoc;
41
42 public abstract class CodeDocImpl extends ExecutableMemberDocImpl {
43
44     /** The CodeDec to which we delegate. */
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 JavaDoc createAdvice() {
53         Set JavaDoc affectedBy = ajc().getCorrespondences().getAffectedBy(codeDec());
54         if (affectedBy.size() < 1) return Collections.EMPTY_LIST;
55         List JavaDoc list = new ArrayList JavaDoc();
56         for (Iterator JavaDoc 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