1 /* 2 * Copyright (c) 2003, 2019, 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 */ 25 26 package jdk.javadoc.internal.doclets.toolkit; 27 28 import java.util.*; 29 30 import javax.lang.model.element.PackageElement; 31 import javax.lang.model.element.TypeElement; 32 import javax.lang.model.element.VariableElement; 33 34 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; 35 36 /** 37 * The interface for writing constants summary output. 38 * 39 * <p><b>This is NOT part of any supported API. 40 * If you write code that depends on this, you do so at your own risk. 41 * This code and its internal interfaces are subject to change or 42 * deletion without notice.</b> 43 */ 44 45 public interface ConstantsSummaryWriter { 46 47 /** 48 * Get the header for the constant summary documentation. 49 * 50 * @return header that needs to be added to the documentation 51 */ getHeader()52 Content getHeader(); 53 54 /** 55 * Get the header for the constant content list. 56 * 57 * @return content header that needs to be added to the documentation 58 */ getContentsHeader()59 Content getContentsHeader(); 60 61 /** 62 * Adds the given package name link to the constant content list tree. 63 * 64 * @param pkg the {@link PackageElement} to index. 65 * @param writtenPackageHeaders the set of package headers that have already 66 * been indexed, we want to index utmost once. 67 * @param contentListTree the content tree to which the link will be added 68 */ addLinkToPackageContent(PackageElement pkg, Set<PackageElement> writtenPackageHeaders, Content contentListTree)69 void addLinkToPackageContent(PackageElement pkg, Set<PackageElement> writtenPackageHeaders, 70 Content contentListTree); 71 72 /** 73 * Add the content list to the documentation tree. 74 * 75 * @param contentListTree the content that will be added to the list 76 */ addContentsList(Content contentListTree)77 void addContentsList(Content contentListTree); 78 79 /** 80 * Get the constant summaries for the document. 81 * 82 * @return constant summaries header to be added to the documentation tree 83 */ getConstantSummaries()84 Content getConstantSummaries(); 85 86 /** 87 * Adds the given package name. 88 * 89 * @param pkg the parsed package name. We only Write the 90 * first 2 directory levels of the package 91 * name. For example, java.lang.ref would be 92 * indexed as java.lang.*. 93 * @param summariesTree the summaries documentation tree 94 * @param first true if the first package is listed 95 * be written 96 */ addPackageName(PackageElement pkg, Content summariesTree, boolean first)97 void addPackageName(PackageElement pkg, Content summariesTree, boolean first); 98 99 /** 100 * Get the class summary header for the constants summary. 101 * 102 * @return the header content for the class constants summary 103 */ getClassConstantHeader()104 Content getClassConstantHeader(); 105 106 /** 107 * Add the content list to the documentation summaries tree. 108 * 109 * @param summariesTree the tree to which the class constants list will be added 110 * @param classConstantTree the class constant tree that will be added to the list 111 */ addClassConstant(Content summariesTree, Content classConstantTree)112 void addClassConstant(Content summariesTree, Content classConstantTree); 113 114 /** 115 * Adds the constant member table to the documentation tree. 116 * 117 * @param typeElement the class whose constants are being documented. 118 * @param fields the constants being documented. 119 * @param classConstantTree the documentation tree to which the constant member 120 * table content will be added 121 */ addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields, Content classConstantTree)122 void addConstantMembers(TypeElement typeElement, Collection<VariableElement> fields, 123 Content classConstantTree); 124 125 /** 126 * Add the summaries list to the content tree. 127 * 128 * @param summariesTree the summaries content tree that will be added to the list 129 */ addConstantSummaries(Content summariesTree)130 void addConstantSummaries(Content summariesTree); 131 132 /** 133 * Adds the footer for the summary documentation. 134 */ addFooter()135 void addFooter(); 136 137 /** 138 * Print the constants summary document. 139 * 140 * @param contentTree content tree which should be printed 141 * @throws DocFileIOException if there is a problem while writing the document 142 */ printDocument(Content contentTree)143 void printDocument(Content contentTree) throws DocFileIOException; 144 } 145