src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java

changeset 2023
cf37c3775397
parent 1997
f050c714b556
child 2413
fe033d997ddf
equal deleted inserted replaced
2022:65c218b25b61 2023:cf37c3775397
394 new EnumMap<Profile, List<PackageDoc>>(Profile.class); 394 new EnumMap<Profile, List<PackageDoc>>(Profile.class);
395 for (Profile p: Profile.values()) 395 for (Profile p: Profile.values())
396 interimResults.put(p, new ArrayList<PackageDoc>()); 396 interimResults.put(p, new ArrayList<PackageDoc>());
397 397
398 for (PackageDoc pkg: packages) { 398 for (PackageDoc pkg: packages) {
399 if (nodeprecated && Util.isDeprecated(pkg)) {
400 continue;
401 }
399 // the getProfile method takes a type name, not a package name, 402 // the getProfile method takes a type name, not a package name,
400 // but isn't particularly fussy about the simple name -- so just use * 403 // but isn't particularly fussy about the simple name -- so just use *
401 int i = profiles.getProfile(pkg.name().replace(".", "/") + "/*"); 404 int i = profiles.getProfile(pkg.name().replace(".", "/") + "/*");
402 Profile p = Profile.lookup(i); 405 Profile p = Profile.lookup(i);
403 if (p != null) { 406 if (p != null) {
407 } 410 }
408 411
409 // Build the profilePackages structure used by the doclet 412 // Build the profilePackages structure used by the doclet
410 profilePackages = new HashMap<String,PackageDoc[]>(); 413 profilePackages = new HashMap<String,PackageDoc[]>();
411 List<PackageDoc> prev = Collections.<PackageDoc>emptyList(); 414 List<PackageDoc> prev = Collections.<PackageDoc>emptyList();
415 int size;
412 for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) { 416 for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) {
413 Profile p = e.getKey(); 417 Profile p = e.getKey();
414 List<PackageDoc> pkgs = e.getValue(); 418 List<PackageDoc> pkgs = e.getValue();
415 pkgs.addAll(prev); // each profile contains all lower profiles 419 pkgs.addAll(prev); // each profile contains all lower profiles
416 Collections.sort(pkgs); 420 Collections.sort(pkgs);
417 profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()])); 421 size = pkgs.size();
422 // For a profile, if there are no packages to be documented, do not add
423 // it to profilePackages map.
424 if (size > 0)
425 profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()]));
418 prev = pkgs; 426 prev = pkgs;
419 } 427 }
420 428
421 // Generate profiles documentation if any profile contains any 429 // Generate profiles documentation if any profile contains any
422 // of the packages to be documented. 430 // of the packages to be documented.
717 } 725 }
718 return true; 726 return true;
719 } 727 }
720 728
721 /** 729 /**
730 * Check the validity of the given profile. Return false if there are no
731 * valid packages to be documented for the profile.
732 *
733 * @param profileName the profile that needs to be validated.
734 * @return true if the profile has valid packages to be documented.
735 */
736 public boolean shouldDocumentProfile(String profileName) {
737 return profilePackages.containsKey(profileName);
738 }
739
740 /**
722 * Check the validity of the given Source or Output File encoding on this 741 * Check the validity of the given Source or Output File encoding on this
723 * platform. 742 * platform.
724 * 743 *
725 * @param docencoding output file encoding. 744 * @param docencoding output file encoding.
726 * @param reporter used to report errors. 745 * @param reporter used to report errors.

mercurial