AnnotationTypeRequiredMemberWriterImpl.java revision 232
0N/A/*
0N/A * Copyright 2003-2004 Sun Microsystems, Inc. All Rights Reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation. Sun designates this
0N/A * particular file as subject to the "Classpath" exception as provided
0N/A * by Sun in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A * CA 95054 USA or visit www.sun.com if you need additional information or
0N/A * have any questions.
0N/A */
0N/A
0N/Apackage com.sun.tools.doclets.formats.html;
0N/A
232N/Aimport java.io.*;
232N/A
0N/Aimport com.sun.javadoc.*;
232N/Aimport com.sun.tools.doclets.internal.toolkit.*;
0N/A
0N/A/**
0N/A * Writes annotation type required member documentation in HTML format.
0N/A *
0N/A * @author Jamie Ho
0N/A */
0N/Apublic class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
0N/A implements AnnotationTypeRequiredMemberWriter, MemberSummaryWriter {
0N/A
0N/A /**
0N/A * Construct a new AnnotationTypeRequiredMemberWriterImpl.
0N/A *
0N/A * @param writer the writer that will write the output.
0N/A * @param annotationType the AnnotationType that holds this member.
0N/A */
0N/A public AnnotationTypeRequiredMemberWriterImpl(SubWriterHolderWriter writer,
0N/A AnnotationTypeDoc annotationType) {
0N/A super(writer, annotationType);
0N/A }
0N/A
0N/A /**
0N/A * Write the annotation type member summary header for the given class.
0N/A *
0N/A * @param classDoc the class the summary belongs to.
0N/A */
0N/A public void writeMemberSummaryHeader(ClassDoc classDoc) {
0N/A writer.println("<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->");
0N/A writer.println();
0N/A writer.printSummaryHeader(this, classDoc);
0N/A }
0N/A
0N/A /**
0N/A * Write the annotation type member summary footer for the given class.
0N/A *
0N/A * @param classDoc the class the summary belongs to.
0N/A */
0N/A public void writeMemberSummaryFooter(ClassDoc classDoc) {
0N/A writer.printSummaryFooter(this, classDoc);
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeInheritedMemberSummaryHeader(ClassDoc classDoc) {
0N/A //Not appliable.
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeInheritedMemberSummary(ClassDoc classDoc,
0N/A ProgramElementDoc member, boolean isFirst, boolean isLast) {
0N/A //Not appliable.
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeInheritedMemberSummaryFooter(ClassDoc classDoc) {
0N/A //Not appliable.
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeHeader(ClassDoc classDoc, String header) {
0N/A writer.println();
0N/A writer.println("<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->");
0N/A writer.println();
0N/A writer.anchor("annotation_type_element_detail");
0N/A writer.printTableHeadingBackground(header);
0N/A writer.println();
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeMemberHeader(MemberDoc member, boolean isFirst) {
0N/A if (! isFirst) {
0N/A writer.printMemberHeader();
0N/A writer.println("");
0N/A }
0N/A writer.anchor(member.name() + ((ExecutableMemberDoc) member).signature());
0N/A writer.h3();
0N/A writer.print(member.name());
0N/A writer.h3End();
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeSignature(MemberDoc member) {
0N/A writer.pre();
0N/A writer.writeAnnotationInfo(member);
0N/A printModifiers(member);
0N/A writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_MEMBER,
0N/A getType(member)));
0N/A print(' ');
0N/A if (configuration().linksource) {
0N/A writer.printSrcLink(member, member.name());
0N/A } else {
181N/A strong(member.name());
0N/A }
0N/A writer.preEnd();
232N/A assert !writer.getMemberDetailsListPrinted();
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeComments(MemberDoc member) {
232N/A printComment(member);
0N/A }
0N/A
0N/A /**
0N/A * Write the tag output for the given member.
0N/A *
0N/A * @param member the member being documented.
0N/A */
0N/A public void writeTags(MemberDoc member) {
0N/A writer.printTags(member);
0N/A }
0N/A
0N/A /**
0N/A * Write the annotation type member footer.
0N/A */
0N/A public void writeMemberFooter() {
232N/A printMemberFooter();
0N/A }
0N/A
0N/A /**
0N/A * Write the footer for the annotation type member documentation.
0N/A *
0N/A * @param classDoc the class that the annotation type member belong to.
0N/A */
0N/A public void writeFooter(ClassDoc classDoc) {
0N/A //No footer to write for annotation type member documentation
0N/A }
0N/A
0N/A /**
0N/A * Close the writer.
0N/A */
0N/A public void close() throws IOException {
0N/A writer.close();
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void printSummaryLabel(ClassDoc cd) {
181N/A writer.strongText("doclet.Annotation_Type_Required_Member_Summary");
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void printSummaryAnchor(ClassDoc cd) {
0N/A writer.anchor("annotation_type_required_element_summary");
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void printInheritedSummaryAnchor(ClassDoc cd) {
0N/A } // no such
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void printInheritedSummaryLabel(ClassDoc cd) {
0N/A // no such
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A protected void writeSummaryLink(int context, ClassDoc cd, ProgramElementDoc member) {
181N/A writer.strong();
0N/A writer.printDocLink(context, (MemberDoc) member, member.name(), false);
181N/A writer.strongEnd();
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A protected void writeInheritedSummaryLink(ClassDoc cd,
0N/A ProgramElementDoc member) {
0N/A //Not applicable.
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A protected void printSummaryType(ProgramElementDoc member) {
0N/A MemberDoc m = (MemberDoc)member;
0N/A printModifierAndType(m, getType(m));
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A protected void writeDeprecatedLink(ProgramElementDoc member) {
0N/A writer.printDocLink(LinkInfoImpl.CONTEXT_MEMBER,
0N/A (MemberDoc) member, ((MemberDoc)member).qualifiedName(), false);
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A protected void printNavSummaryLink(ClassDoc cd, boolean link) {
0N/A if (link) {
0N/A writer.printHyperLink("", "annotation_type_required_element_summary",
0N/A configuration().getText("doclet.navAnnotationTypeRequiredMember"));
0N/A } else {
0N/A writer.printText("doclet.navAnnotationTypeRequiredMember");
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A protected void printNavDetailLink(boolean link) {
0N/A if (link) {
0N/A writer.printHyperLink("", "annotation_type_element_detail",
0N/A configuration().getText("doclet.navAnnotationTypeMember"));
0N/A } else {
0N/A writer.printText("doclet.navAnnotationTypeMember");
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * {@inheritDoc}
0N/A */
0N/A public void writeDeprecated(MemberDoc member) {
232N/A printDeprecated(member);
0N/A }
0N/A
0N/A private Type getType(MemberDoc member) {
0N/A if (member instanceof FieldDoc) {
0N/A return ((FieldDoc) member).type();
0N/A } else {
0N/A return ((MethodDoc) member).returnType();
0N/A }
0N/A }
0N/A}