src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeBuilder.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 21,37 **** * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package com.sun.tools.doclets.internal.toolkit.builders; import java.io.*; ! import com.sun.javadoc.*; ! import com.sun.tools.doclets.internal.toolkit.*; /** * Builds the summary for a given annotation type. * * <p><b>This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. --- 21,41 ---- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ ! package jdk.javadoc.internal.doclets.toolkit.builders; import java.io.*; ! import javax.lang.model.element.PackageElement; ! import javax.lang.model.element.TypeElement; + import jdk.javadoc.internal.doclets.toolkit.AnnotationTypeWriter; + import jdk.javadoc.internal.doclets.toolkit.Content; + + /** * Builds the summary for a given annotation type. * * <p><b>This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk.
*** 50,60 **** public static final String ROOT = "AnnotationTypeDoc"; /** * The annotation type being documented. */ ! private final AnnotationTypeDoc annotationTypeDoc; /** * The doclet specific writer. */ private final AnnotationTypeWriter writer; --- 54,64 ---- public static final String ROOT = "AnnotationTypeDoc"; /** * The annotation type being documented. */ ! private final TypeElement annotationType; /** * The doclet specific writer. */ private final AnnotationTypeWriter writer;
*** 70,83 **** * @param context the build context. * @param annotationTypeDoc the class being documented. * @param writer the doclet specific writer. */ private AnnotationTypeBuilder(Context context, ! AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer) { super(context); ! this.annotationTypeDoc = annotationTypeDoc; this.writer = writer; } /** * Construct a new ClassBuilder. --- 74,87 ---- * @param context the build context. * @param annotationTypeDoc the class being documented. * @param writer the doclet specific writer. */ private AnnotationTypeBuilder(Context context, ! TypeElement annotationTypeDoc, AnnotationTypeWriter writer) { super(context); ! this.annotationType = annotationTypeDoc; this.writer = writer; } /** * Construct a new ClassBuilder.
*** 85,95 **** * @param context the build context. * @param annotationTypeDoc the class being documented. * @param writer the doclet specific writer. */ public static AnnotationTypeBuilder getInstance(Context context, ! AnnotationTypeDoc annotationTypeDoc, AnnotationTypeWriter writer) throws Exception { return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); } --- 89,99 ---- * @param context the build context. * @param annotationTypeDoc the class being documented. * @param writer the doclet specific writer. */ public static AnnotationTypeBuilder getInstance(Context context, ! TypeElement annotationTypeDoc, AnnotationTypeWriter writer) throws Exception { return new AnnotationTypeBuilder(context, annotationTypeDoc, writer); }
*** 113,123 **** * @param node the XML element that specifies which components to document * @param contentTree the content tree to which the documentation will be added */ public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception { contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") + ! " " + annotationTypeDoc.name()); Content annotationContentTree = writer.getAnnotationContentHeader(); buildChildren(node, annotationContentTree); writer.addAnnotationContentTree(contentTree, annotationContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); --- 117,127 ---- * @param node the XML element that specifies which components to document * @param contentTree the content tree to which the documentation will be added */ public void buildAnnotationTypeDoc(XMLNode node, Content contentTree) throws Exception { contentTree = writer.getHeader(configuration.getText("doclet.AnnotationType") + ! " " + utils.getSimpleName(annotationType)); Content annotationContentTree = writer.getAnnotationContentHeader(); buildChildren(node, annotationContentTree); writer.addAnnotationContentTree(contentTree, annotationContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree);
*** 124,144 **** writer.close(); copyDocFiles(); } /** ! * Copy the doc files for the current ClassDoc if necessary. */ private void copyDocFiles() { ! PackageDoc containingPackage = annotationTypeDoc.containingPackage(); if((configuration.packages == null || !configuration.packages.contains(containingPackage) && !containingPackagesSeen.contains(containingPackage))){ //Only copy doc files dir if the containing package is not //documented AND if we have not documented a class from the same //package already. Otherwise, we are making duplicate copies. ! utils.copyDocFiles(configuration, containingPackage); containingPackagesSeen.add(containingPackage); } } /** --- 128,148 ---- writer.close(); copyDocFiles(); } /** ! * Copy the doc files for the current TypeElement if necessary. */ private void copyDocFiles() { ! PackageElement containingPackage = utils.containingPackage(annotationType); if((configuration.packages == null || !configuration.packages.contains(containingPackage) && !containingPackagesSeen.contains(containingPackage))){ //Only copy doc files dir if the containing package is not //documented AND if we have not documented a class from the same //package already. Otherwise, we are making duplicate copies. ! utils.copyDocFiles(containingPackage); containingPackagesSeen.add(containingPackage); } } /**
*** 168,181 **** * * @param node the XML element that specifies which components to document * @param annotationInfoTree the content tree to which the documentation will be added */ public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) { ! StringBuilder modifiers = new StringBuilder( ! annotationTypeDoc.modifiers() + " "); ! writer.addAnnotationTypeSignature(utils.replaceText( ! modifiers.toString(), "interface", "@interface"), annotationInfoTree); } /** * Build the annotation type description. * --- 172,183 ---- * * @param node the XML element that specifies which components to document * @param annotationInfoTree the content tree to which the documentation will be added */ public void buildAnnotationTypeSignature(XMLNode node, Content annotationInfoTree) { ! writer.addAnnotationTypeSignature(utils.modifiersToString(annotationType, true), ! annotationInfoTree); } /** * Build the annotation type description. *