langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
changeset 22163 3651128c74eb
parent 22159 682da512ec17
equal deleted inserted replaced
22162:3b3e23e67329 22163:3651128c74eb
    95      */
    95      */
    96     private ConstantsSummaryBuilder(Context context,
    96     private ConstantsSummaryBuilder(Context context,
    97             ConstantsSummaryWriter writer) {
    97             ConstantsSummaryWriter writer) {
    98         super(context);
    98         super(context);
    99         this.writer = writer;
    99         this.writer = writer;
   100         this.classDocsWithConstFields = new HashSet<ClassDoc>();
   100         this.classDocsWithConstFields = new HashSet<>();
   101     }
   101     }
   102 
   102 
   103     /**
   103     /**
   104      * Construct a ConstantsSummaryBuilder.
   104      * Construct a ConstantsSummaryBuilder.
   105      *
   105      *
   149      * @param node the XML element that specifies which components to document
   149      * @param node the XML element that specifies which components to document
   150      * @param contentTree the content tree to which the content list will be added
   150      * @param contentTree the content tree to which the content list will be added
   151      */
   151      */
   152     public void buildContents(XMLNode node, Content contentTree) {
   152     public void buildContents(XMLNode node, Content contentTree) {
   153         Content contentListTree = writer.getContentsHeader();
   153         Content contentListTree = writer.getContentsHeader();
   154         printedPackageHeaders = new HashSet<String>();
   154         printedPackageHeaders = new HashSet<>();
   155         for (PackageDoc pkg : configuration.packages) {
   155         for (PackageDoc pkg : configuration.packages) {
   156             if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg.name())) {
   156             if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg.name())) {
   157                 writer.addLinkToPackageContent(pkg,
   157                 writer.addLinkToPackageContent(pkg,
   158                                                parsePackageName(pkg.name()),
   158                                                parsePackageName(pkg.name()),
   159                                                printedPackageHeaders, contentListTree);
   159                                                printedPackageHeaders, contentListTree);
   167      *
   167      *
   168      * @param node the XML element that specifies which components to document
   168      * @param node the XML element that specifies which components to document
   169      * @param contentTree the tree to which the summaries will be added
   169      * @param contentTree the tree to which the summaries will be added
   170      */
   170      */
   171     public void buildConstantSummaries(XMLNode node, Content contentTree) {
   171     public void buildConstantSummaries(XMLNode node, Content contentTree) {
   172         printedPackageHeaders = new HashSet<String>();
   172         printedPackageHeaders = new HashSet<>();
   173         Content summariesTree = writer.getConstantSummaries();
   173         Content summariesTree = writer.getConstantSummaries();
   174         for (PackageDoc aPackage : configuration.packages) {
   174         for (PackageDoc aPackage : configuration.packages) {
   175             if (hasConstantField(aPackage)) {
   175             if (hasConstantField(aPackage)) {
   176                 currentPackage = aPackage;
   176                 currentPackage = aPackage;
   177                 //Build the documentation for the current package.
   177                 //Build the documentation for the current package.
   329          * @param node the XML element that specifies which components to document
   329          * @param node the XML element that specifies which components to document
   330          * @param classConstantTree the tree to which the class constants table
   330          * @param classConstantTree the tree to which the class constants table
   331          *                          will be added
   331          *                          will be added
   332          */
   332          */
   333         protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
   333         protected void buildMembersSummary(XMLNode node, Content classConstantTree) {
   334             List<FieldDoc> members = new ArrayList<FieldDoc>(members());
   334             List<FieldDoc> members = new ArrayList<>(members());
   335             if (members.size() > 0) {
   335             if (members.size() > 0) {
   336                 Collections.sort(members);
   336                 Collections.sort(members);
   337                 writer.addConstantMembers(classdoc, members, classConstantTree);
   337                 writer.addConstantMembers(classdoc, members, classConstantTree);
   338             }
   338             }
   339         }
   339         }
   350             if(l != null){
   350             if(l != null){
   351                 iter = l.iterator();
   351                 iter = l.iterator();
   352             } else {
   352             } else {
   353                 return null;
   353                 return null;
   354             }
   354             }
   355             List<FieldDoc> inclList = new LinkedList<FieldDoc>();
   355             List<FieldDoc> inclList = new LinkedList<>();
   356             FieldDoc member;
   356             FieldDoc member;
   357             while(iter.hasNext()){
   357             while(iter.hasNext()){
   358                 member = (FieldDoc)iter.next();
   358                 member = (FieldDoc)iter.next();
   359                 if(member.constantValue() != null){
   359                 if(member.constantValue() != null){
   360                     inclList.add(member);
   360                     inclList.add(member);