langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
89 * Stores interfaces for each package |
89 * Stores interfaces for each package |
90 */ |
90 */ |
91 private Map<String,Set<ClassDoc>> interfaces; |
91 private Map<String,Set<ClassDoc>> interfaces; |
92 |
92 |
93 private Configuration configuration; |
93 private Configuration configuration; |
|
94 private Utils utils; |
94 |
95 |
95 /** |
96 /** |
96 * Construct a new ClassDocCatalog. |
97 * Construct a new ClassDocCatalog. |
97 * |
98 * |
98 * @param classdocs the array of ClassDocs to catalog |
99 * @param classdocs the array of ClassDocs to catalog |
99 */ |
100 */ |
100 public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) { |
101 public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) { |
101 init(); |
102 init(); |
102 this.configuration = config; |
103 this.configuration = config; |
|
104 this.utils = config.utils; |
103 for (ClassDoc classdoc : classdocs) { |
105 for (ClassDoc classdoc : classdocs) { |
104 addClassDoc(classdoc); |
106 addClassDoc(classdoc); |
105 } |
107 } |
106 } |
108 } |
107 |
109 |
154 * @param map the Map to add the ClassDoc to. |
156 * @param map the Map to add the ClassDoc to. |
155 */ |
157 */ |
156 private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) { |
158 private void addClass(ClassDoc classdoc, Map<String,Set<ClassDoc>> map) { |
157 |
159 |
158 PackageDoc pkg = classdoc.containingPackage(); |
160 PackageDoc pkg = classdoc.containingPackage(); |
159 if (pkg.isIncluded() || (configuration.nodeprecated && Util.isDeprecated(pkg))) { |
161 if (pkg.isIncluded() || (configuration.nodeprecated && utils.isDeprecated(pkg))) { |
160 //No need to catalog this class if it's package is |
162 //No need to catalog this class if it's package is |
161 //included on the command line or if -nodeprecated option is set |
163 //included on the command line or if -nodeprecated option is set |
162 // and the containing package is marked as deprecated. |
164 // and the containing package is marked as deprecated. |
163 return; |
165 return; |
164 } |
166 } |
165 String key = Util.getPackageName(pkg); |
167 String key = utils.getPackageName(pkg); |
166 Set<ClassDoc> s = map.get(key); |
168 Set<ClassDoc> s = map.get(key); |
167 if (s == null) { |
169 if (s == null) { |
168 packageSet.add(key); |
170 packageSet.add(key); |
169 s = new HashSet<>(); |
171 s = new HashSet<>(); |
170 } |
172 } |
188 * @param pkgDoc the package to return the classes for. |
190 * @param pkgDoc the package to return the classes for. |
189 */ |
191 */ |
190 public ClassDoc[] allClasses(PackageDoc pkgDoc) { |
192 public ClassDoc[] allClasses(PackageDoc pkgDoc) { |
191 return pkgDoc.isIncluded() ? |
193 return pkgDoc.isIncluded() ? |
192 pkgDoc.allClasses() : |
194 pkgDoc.allClasses() : |
193 getArray(allClasses, Util.getPackageName(pkgDoc)); |
195 getArray(allClasses, utils.getPackageName(pkgDoc)); |
194 } |
196 } |
195 |
197 |
196 /** |
198 /** |
197 * Return all of the classes specified on the command-line that |
199 * Return all of the classes specified on the command-line that |
198 * belong to the given package. |
200 * belong to the given package. |