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

Tue, 09 Oct 2012 19:10:00 -0700

author
jjg
date
Tue, 09 Oct 2012 19:10:00 -0700
changeset 1357
c75be5bc5283
parent 798
4868a36f6fd8
child 1359
25e14ad23cef
permissions
-rw-r--r--

8000663: clean up langtools imports
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     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
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.doclets.internal.toolkit.builders;
    28 import java.util.*;
    30 import com.sun.javadoc.*;
    31 import com.sun.tools.doclets.internal.toolkit.*;
    32 import com.sun.tools.doclets.internal.toolkit.util.*;
    34 /**
    35  * Builds documentation for optional annotation type members.
    36  *
    37  * This code is not part of an API.
    38  * It is implementation that is subject to change.
    39  * Do not use it as an API
    40  *
    41  * @author Jamie Ho
    42  * @author Bhavesh Patel (Modified)
    43  * @since 1.5
    44  */
    45 public class AnnotationTypeOptionalMemberBuilder extends
    46     AnnotationTypeRequiredMemberBuilder {
    49     /**
    50      * Construct a new AnnotationTypeMemberBuilder.
    51      *
    52      * @param configuration the current configuration of the
    53      *                      doclet.
    54      */
    55     private AnnotationTypeOptionalMemberBuilder(Configuration configuration) {
    56         super(configuration);
    57     }
    60     /**
    61      * Construct a new AnnotationTypeMemberBuilder.
    62      *
    63      * @param configuration the current configuration of the doclet.
    64      * @param classDoc the class whoses members are being documented.
    65      * @param writer the doclet specific writer.
    66      */
    67     public static AnnotationTypeOptionalMemberBuilder getInstance(
    68             Configuration configuration, ClassDoc classDoc,
    69             AnnotationTypeOptionalMemberWriter writer) {
    70         AnnotationTypeOptionalMemberBuilder builder =
    71             new AnnotationTypeOptionalMemberBuilder(configuration);
    72         builder.classDoc = classDoc;
    73         builder.writer = writer;
    74         builder.visibleMemberMap = new VisibleMemberMap(classDoc,
    75             VisibleMemberMap.ANNOTATION_TYPE_MEMBER_OPTIONAL, configuration.nodeprecated);
    76         builder.members = new ArrayList<ProgramElementDoc>(
    77             builder.visibleMemberMap.getMembersFor(classDoc));
    78         if (configuration.getMemberComparator() != null) {
    79             Collections.sort(builder.members,
    80                 configuration.getMemberComparator());
    81         }
    82         return builder;
    83     }
    85     /**
    86      * {@inheritDoc}
    87      */
    88     @Override
    89     public String getName() {
    90         return "AnnotationTypeOptionalMemberDetails";
    91     }
    93     /**
    94      * Build the annotation type optional member documentation.
    95      *
    96      * @param node the XML element that specifies which components to document
    97      * @param memberDetailsTree the content tree to which the documentation will be added
    98      */
    99     public void buildAnnotationTypeOptionalMember(XMLNode node, Content memberDetailsTree) {
   100         buildAnnotationTypeMember(node, memberDetailsTree);
   101     }
   103     /**
   104      * Build the default value for this optional member.
   105      *
   106      * @param node the XML element that specifies which components to document
   107      * @param annotationDocTree the content tree to which the documentation will be added
   108      */
   109     public void buildDefaultValueInfo(XMLNode node, Content annotationDocTree) {
   110         ((AnnotationTypeOptionalMemberWriter) writer).addDefaultValueInfo(
   111                 (MemberDoc) members.get(currentMemberIndex),
   112                 annotationDocTree);
   113     }
   115     /**
   116      * {@inheritDoc}
   117      */
   118     @Override
   119     public AnnotationTypeRequiredMemberWriter getWriter() {
   120         return writer;
   121     }
   122 }

mercurial