KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > tools > doclets > standard > DeprecatedAPIListBuilder


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.doclets.standard;
23
24 import org.aspectj.ajdoc.AspectDoc;
25 import org.aspectj.ajdoc.IntroducedDoc;
26 import org.aspectj.ajdoc.IntroductionDoc;
27 import org.aspectj.tools.ajdoc.Util;
28
29 import com.sun.javadoc.ClassDoc;
30 import com.sun.javadoc.MemberDoc;
31 import com.sun.javadoc.RootDoc;
32
33 import java.util.ArrayList JavaDoc;
34 import java.util.Collections JavaDoc;
35 import java.util.List JavaDoc;
36
37 public class DeprecatedAPIListBuilder
38     extends com.sun.tools.doclets.standard.DeprecatedAPIListBuilder
39 {
40     
41     private List JavaDoc deprecatedadvice = new ArrayList JavaDoc();
42     private List JavaDoc deprecatedpointcuts = new ArrayList JavaDoc();
43     private List JavaDoc deprecatedfieldintroductions = new ArrayList JavaDoc();
44     private List JavaDoc deprecatedmethodintroductions = new ArrayList JavaDoc();
45     private List JavaDoc deprecatedconstructorintroductions = new ArrayList JavaDoc();
46     private List JavaDoc deprecatedsuperintroductions = new ArrayList JavaDoc();
47     
48     public DeprecatedAPIListBuilder(RootDoc root) {
49         super(root);
50         buildDeprecatedAPIInfo(root);
51     }
52
53     protected void buildDeprecatedAPIInfo(RootDoc root) {
54         ClassDoc[] cs = root.classes();
55         for (int i = 0; i < cs.length; i++) {
56             org.aspectj.ajdoc.ClassDoc c = (org.aspectj.ajdoc.ClassDoc)cs[i];
57             _composeDeprecatedList(deprecatedpointcuts, c.pointcuts());
58             if (c instanceof AspectDoc) {
59                 AspectDoc ad = (AspectDoc)c;
60                 _composeDeprecatedList(deprecatedadvice, ad.advice());
61                 IntroductionDoc[] intros = ad.introductions();
62                 for (int j = 0; j < intros.length; j++) {
63                     if (intros[j] instanceof IntroducedDoc) {
64                         MemberDoc md = ((IntroducedDoc)intros[j]).member();
65                         if (md == null) continue;
66                         if (md.isField()) {
67                             _composeDeprecatedList(deprecatedfieldintroductions,
68                                                    intros[j]);
69                         } else if (md.isMethod()) {
70                             _composeDeprecatedList(deprecatedmethodintroductions,
71                                                    intros[j]);
72                         } else {
73                             _composeDeprecatedList(deprecatedconstructorintroductions,
74                                                    intros[j]);
75                         }
76                     } else {
77                         _composeDeprecatedList(deprecatedsuperintroductions,
78                                                intros[j]);
79                     }
80                 }
81             }
82         }
83         Collections.sort(deprecatedadvice);
84         Collections.sort(deprecatedpointcuts);
85         Collections.sort(deprecatedfieldintroductions);
86         Collections.sort(deprecatedmethodintroductions);
87         Collections.sort(deprecatedconstructorintroductions);
88         Collections.sort(deprecatedsuperintroductions);
89     }
90
91     protected void _composeDeprecatedList(List JavaDoc list, MemberDoc member) {
92         _composeDeprecatedList(list, new MemberDoc[]{member});
93     }
94     protected void _composeDeprecatedList(List JavaDoc list, MemberDoc[] members) {
95         Util.invoke(com.sun.tools.doclets.standard.DeprecatedAPIListBuilder.class,
96                     this, "composeDeprecatedList",
97                     new Class JavaDoc[]{java.util.List JavaDoc.class,
98                                 com.sun.javadoc.MemberDoc[].class},
99                     new Object JavaDoc[]{list, members});
100     }
101
102     public List JavaDoc getDeprecatedAdivce() {
103         return deprecatedadvice;
104     }
105     public List JavaDoc getDeprecatedPointcuts() {
106         return deprecatedpointcuts;
107     }
108     public List JavaDoc getDeprecatedFieldIntroductions() {
109         return deprecatedfieldintroductions;
110     }
111     public List JavaDoc getDeprecatedMethodIntroductions() {
112         return deprecatedmethodintroductions;
113     }
114     public List JavaDoc getDeprecatedConstructorIntroductions() {
115         return deprecatedconstructorintroductions;
116     }
117     public List JavaDoc getDeprecatedSuperIntroductions() {
118         return deprecatedsuperintroductions;
119     }
120 }
121
Popular Tags