src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java

Wed, 18 Sep 2013 17:13:26 -0700

author
bpatel
date
Wed, 18 Sep 2013 17:13:26 -0700
changeset 2035
a2a5ad0853ed
parent 1747
df4f44800923
child 2101
933ba3f81a87
permissions
-rw-r--r--

8015249: javadoc fails to document static final fields in annotation types
Reviewed-by: jjg

     1 /*
     2  * Copyright (c) 2003, 2013, 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.formats.html;
    28 import java.io.*;
    30 import com.sun.javadoc.*;
    31 import com.sun.tools.doclets.formats.html.markup.*;
    32 import com.sun.tools.doclets.internal.toolkit.*;
    34 /**
    35  * Writes annotation type optional member documentation in HTML format.
    36  *
    37  *  <p><b>This is NOT part of any supported API.
    38  *  If you write code that depends on this, you do so at your own risk.
    39  *  This code and its internal interfaces are subject to change or
    40  *  deletion without notice.</b>
    41  *
    42  * @author Jamie Ho
    43  * @author Bhavesh Patel (Modified)
    44  */
    45 public class AnnotationTypeOptionalMemberWriterImpl extends
    46         AnnotationTypeRequiredMemberWriterImpl
    47     implements AnnotationTypeOptionalMemberWriter, MemberSummaryWriter {
    49     /**
    50      * Construct a new AnnotationTypeOptionalMemberWriterImpl.
    51      *
    52      * @param writer         the writer that will write the output.
    53      * @param annotationType the AnnotationType that holds this member.
    54      */
    55     public AnnotationTypeOptionalMemberWriterImpl(SubWriterHolderWriter writer,
    56         AnnotationTypeDoc annotationType) {
    57         super(writer, annotationType);
    58     }
    60     /**
    61      * {@inheritDoc}
    62      */
    63     public Content getMemberSummaryHeader(ClassDoc classDoc,
    64             Content memberSummaryTree) {
    65         memberSummaryTree.addContent(
    66                 HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
    67         Content memberTree = writer.getMemberTreeHeader();
    68         writer.addSummaryHeader(this, classDoc, memberTree);
    69         return memberTree;
    70     }
    72     /**
    73      * {@inheritDoc}
    74      */
    75     public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree) {
    76         if (((AnnotationTypeElementDoc) member).defaultValue() != null) {
    77             Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
    78             Content dl = HtmlTree.DL(dt);
    79             Content dd = HtmlTree.DD(new StringContent(
    80                     ((AnnotationTypeElementDoc) member).defaultValue().toString()));
    81             dl.addContent(dd);
    82             annotationDocTree.addContent(dl);
    83         }
    84     }
    86     /**
    87      * {@inheritDoc}
    88      */
    89     public void close() throws IOException {
    90         writer.close();
    91     }
    93     /**
    94      * {@inheritDoc}
    95      */
    96     public void addSummaryLabel(Content memberTree) {
    97         Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
    98                 writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
    99         memberTree.addContent(label);
   100     }
   102     /**
   103      * {@inheritDoc}
   104      */
   105     public String getTableSummary() {
   106         return configuration.getText("doclet.Member_Table_Summary",
   107                 configuration.getText("doclet.Annotation_Type_Optional_Member_Summary"),
   108                 configuration.getText("doclet.annotation_type_optional_members"));
   109     }
   111     /**
   112      * {@inheritDoc}
   113      */
   114     public Content getCaption() {
   115         return configuration.getResource("doclet.Annotation_Type_Optional_Members");
   116     }
   118     /**
   119      * {@inheritDoc}
   120      */
   121     public String[] getSummaryTableHeader(ProgramElementDoc member) {
   122         String[] header = new String[] {
   123             writer.getModifierTypeHeader(),
   124             configuration.getText("doclet.0_and_1",
   125                     configuration.getText("doclet.Annotation_Type_Optional_Member"),
   126                     configuration.getText("doclet.Description"))
   127         };
   128         return header;
   129     }
   131     /**
   132      * {@inheritDoc}
   133      */
   134     public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
   135         memberTree.addContent(writer.getMarkerAnchor(
   136                 "annotation_type_optional_element_summary"));
   137     }
   139     /**
   140      * {@inheritDoc}
   141      */
   142     protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
   143         if (link) {
   144             return writer.getHyperLink("annotation_type_optional_element_summary",
   145                     writer.getResource("doclet.navAnnotationTypeOptionalMember"));
   146         } else {
   147             return writer.getResource("doclet.navAnnotationTypeOptionalMember");
   148         }
   149     }
   150 }

mercurial