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

Wed, 10 Oct 2012 16:48:21 -0700

author
jjg
date
Wed, 10 Oct 2012 16:48:21 -0700
changeset 1359
25e14ad23cef
parent 798
4868a36f6fd8
child 1372
78962d89f283
permissions
-rw-r--r--

8000665: fix "internal API" comments on javadoc files
Reviewed-by: darcy

duke@1 1 /*
jjg@1359 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package com.sun.tools.doclets.formats.html;
duke@1 27
bpatel@233 28 import java.io.*;
bpatel@233 29
bpatel@233 30 import com.sun.javadoc.*;
bpatel@766 31 import com.sun.tools.doclets.formats.html.markup.*;
duke@1 32 import com.sun.tools.doclets.internal.toolkit.*;
duke@1 33
duke@1 34 /**
duke@1 35 * Writes annotation type optional member documentation in HTML format.
duke@1 36 *
jjg@1359 37 * <p><b>This is NOT part of any supported API.
jjg@1359 38 * If you write code that depends on this, you do so at your own risk.
jjg@1359 39 * This code and its internal interfaces are subject to change or
jjg@1359 40 * deletion without notice.</b>
jjg@1359 41 *
duke@1 42 * @author Jamie Ho
bpatel@243 43 * @author Bhavesh Patel (Modified)
duke@1 44 */
duke@1 45 public class AnnotationTypeOptionalMemberWriterImpl extends
duke@1 46 AnnotationTypeRequiredMemberWriterImpl
duke@1 47 implements AnnotationTypeOptionalMemberWriter, MemberSummaryWriter {
duke@1 48
duke@1 49 /**
duke@1 50 * Construct a new AnnotationTypeOptionalMemberWriterImpl.
duke@1 51 *
duke@1 52 * @param writer the writer that will write the output.
duke@1 53 * @param annotationType the AnnotationType that holds this member.
duke@1 54 */
duke@1 55 public AnnotationTypeOptionalMemberWriterImpl(SubWriterHolderWriter writer,
duke@1 56 AnnotationTypeDoc annotationType) {
duke@1 57 super(writer, annotationType);
duke@1 58 }
duke@1 59
duke@1 60 /**
duke@1 61 * {@inheritDoc}
duke@1 62 */
bpatel@766 63 public Content getMemberSummaryHeader(ClassDoc classDoc,
bpatel@766 64 Content memberSummaryTree) {
bpatel@766 65 memberSummaryTree.addContent(
bpatel@766 66 HtmlConstants.START_OF_ANNOTATION_TYPE_OPTIONAL_MEMBER_SUMMARY);
bpatel@766 67 Content memberTree = writer.getMemberTreeHeader();
bpatel@766 68 writer.addSummaryHeader(this, classDoc, memberTree);
bpatel@766 69 return memberTree;
duke@1 70 }
duke@1 71
duke@1 72 /**
duke@1 73 * {@inheritDoc}
duke@1 74 */
bpatel@766 75 public void addDefaultValueInfo(MemberDoc member, Content annotationDocTree) {
bpatel@233 76 if (((AnnotationTypeElementDoc) member).defaultValue() != null) {
bpatel@766 77 Content dt = HtmlTree.DT(writer.getResource("doclet.Default"));
bpatel@766 78 Content dl = HtmlTree.DL(dt);
bpatel@766 79 Content dd = HtmlTree.DD(new StringContent(
bpatel@766 80 ((AnnotationTypeElementDoc) member).defaultValue().toString()));
bpatel@766 81 dl.addContent(dd);
bpatel@766 82 annotationDocTree.addContent(dl);
bpatel@233 83 }
duke@1 84 }
duke@1 85
duke@1 86 /**
duke@1 87 * {@inheritDoc}
duke@1 88 */
duke@1 89 public void close() throws IOException {
duke@1 90 writer.close();
duke@1 91 }
duke@1 92
duke@1 93 /**
duke@1 94 * {@inheritDoc}
duke@1 95 */
bpatel@766 96 public void addSummaryLabel(Content memberTree) {
bpatel@766 97 Content label = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING,
bpatel@766 98 writer.getResource("doclet.Annotation_Type_Optional_Member_Summary"));
bpatel@766 99 memberTree.addContent(label);
bpatel@243 100 }
bpatel@243 101
bpatel@243 102 /**
bpatel@243 103 * {@inheritDoc}
bpatel@243 104 */
bpatel@766 105 public String getTableSummary() {
bpatel@766 106 return configuration().getText("doclet.Member_Table_Summary",
bpatel@243 107 configuration().getText("doclet.Annotation_Type_Optional_Member_Summary"),
bpatel@766 108 configuration().getText("doclet.annotation_type_optional_members"));
bpatel@243 109 }
bpatel@243 110
bpatel@766 111 /**
bpatel@766 112 * {@inheritDoc}
bpatel@766 113 */
bpatel@766 114 public String getCaption() {
bpatel@766 115 return configuration().getText("doclet.Annotation_Type_Optional_Members");
bpatel@766 116 }
bpatel@766 117
bpatel@766 118 /**
bpatel@766 119 * {@inheritDoc}
bpatel@766 120 */
bpatel@766 121 public String[] getSummaryTableHeader(ProgramElementDoc member) {
bpatel@243 122 String[] header = new String[] {
bpatel@243 123 writer.getModifierTypeHeader(),
bpatel@243 124 configuration().getText("doclet.0_and_1",
bpatel@243 125 configuration().getText("doclet.Annotation_Type_Optional_Member"),
bpatel@243 126 configuration().getText("doclet.Description"))
bpatel@243 127 };
bpatel@766 128 return header;
duke@1 129 }
duke@1 130
duke@1 131 /**
duke@1 132 * {@inheritDoc}
duke@1 133 */
bpatel@766 134 public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
bpatel@766 135 memberTree.addContent(writer.getMarkerAnchor(
bpatel@766 136 "annotation_type_optional_element_summary"));
duke@1 137 }
duke@1 138
duke@1 139 /**
duke@1 140 * {@inheritDoc}
duke@1 141 */
bpatel@766 142 protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
duke@1 143 if (link) {
bpatel@766 144 return writer.getHyperLink("", "annotation_type_optional_element_summary",
bpatel@766 145 writer.getResource("doclet.navAnnotationTypeOptionalMember"));
duke@1 146 } else {
bpatel@766 147 return writer.getResource("doclet.navAnnotationTypeOptionalMember");
duke@1 148 }
duke@1 149 }
duke@1 150 }

mercurial