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 javax.lang.model.element.TypeElement;
29 
30 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
31 
32 /**
33  * The interface for writing class output.
34  *
35  *  <p><b>This is NOT part of any supported API.
36  *  If you write code that depends on this, you do so at your own risk.
37  *  This code and its internal interfaces are subject to change or
38  *  deletion without notice.</b>
39  */
40 
41 public interface ClassWriter {
42 
43     /**
44      * Get the header of the page.
45      *
46      * @param header the header string to write
47      * @return header content that needs to be added to the documentation
48      */
getHeader(String header)49     Content getHeader(String header);
50 
51     /**
52      * Get the class content header.
53      *
54      * @return class content header that needs to be added to the documentation
55      */
getClassContentHeader()56     Content getClassContentHeader();
57 
58     /**
59      * Add the class tree documentation.
60      *
61      * @param classContentTree class content tree to which the documentation will be added
62      */
addClassTree(Content classContentTree)63     void addClassTree(Content classContentTree);
64 
65     /**
66      * Get the class information tree header.
67      *
68      * @return class information tree header that needs to be added to the documentation
69      */
getClassInfoTreeHeader()70     Content getClassInfoTreeHeader();
71 
72     /**
73      * Add the type parameter and state component information.
74      *
75      * @param classInfoTree content tree to which the documentation will be added
76      */
addParamInfo(Content classInfoTree)77     void addParamInfo(Content classInfoTree);
78 
79     /**
80      * Add all super interfaces if this is an interface.
81      *
82      * @param classInfoTree content tree to which the documentation will be added
83      */
addSuperInterfacesInfo(Content classInfoTree)84     void addSuperInterfacesInfo(Content classInfoTree);
85 
86     /**
87      * Add all implemented interfaces if this is a class.
88      *
89      * @param classInfoTree content tree to which the documentation will be added
90      */
addImplementedInterfacesInfo(Content classInfoTree)91     void addImplementedInterfacesInfo(Content classInfoTree);
92 
93     /**
94      * Add all the classes that extend this one.
95      *
96      * @param classInfoTree content tree to which the documentation will be added
97      */
addSubClassInfo(Content classInfoTree)98     void addSubClassInfo(Content classInfoTree);
99 
100     /**
101      * Add all the interfaces that extend this one.
102      *
103      * @param classInfoTree content tree to which the documentation will be added
104      */
addSubInterfacesInfo(Content classInfoTree)105     void addSubInterfacesInfo(Content classInfoTree);
106 
107     /**
108      * If this is an interface, add all classes that implement this
109      * interface.
110      *
111      * @param classInfoTree content tree to which the documentation will be added
112      */
addInterfaceUsageInfo(Content classInfoTree)113     void addInterfaceUsageInfo(Content classInfoTree);
114 
115     /**
116      * If this is an functional interface, display appropriate message.
117      *
118      * @param classInfoTree content tree to which the documentation will be added
119      */
addFunctionalInterfaceInfo(Content classInfoTree)120     void addFunctionalInterfaceInfo(Content classInfoTree);
121 
122     /**
123      * If this is an inner class or interface, add the enclosing class or
124      * interface.
125      *
126      * @param classInfoTree content tree to which the documentation will be added
127      */
addNestedClassInfo(Content classInfoTree)128     void addNestedClassInfo(Content classInfoTree);
129 
130     /**
131      * Get the class information.
132      *
133      * @param classInfoTree content tree containing the class information
134      * @return a content tree for the class
135      */
getClassInfo(Content classInfoTree)136     Content getClassInfo(Content classInfoTree);
137 
138     /**
139      * If this class is deprecated, add the appropriate information.
140      *
141      * @param classInfoTree content tree to which the documentation will be added
142      */
addClassDeprecationInfo(Content classInfoTree)143     void addClassDeprecationInfo(Content classInfoTree);
144 
145     /**
146      * Add the signature of the current class content tree.
147      *
148      * @param modifiers the modifiers for the signature
149      * @param classInfoTree the class content tree to which the signature will be added
150      */
addClassSignature(String modifiers, Content classInfoTree)151     void addClassSignature(String modifiers, Content classInfoTree);
152 
153     /**
154      * Build the class description.
155      *
156      * @param classInfoTree content tree to which the documentation will be added
157      */
addClassDescription(Content classInfoTree)158     void addClassDescription(Content classInfoTree);
159 
160     /**
161      * Add the tag information for the current class.
162      *
163      * @param classInfoTree content tree to which the tag information will be added
164      */
addClassTagInfo(Content classInfoTree)165     void addClassTagInfo(Content classInfoTree);
166 
167     /**
168      * Get the member tree header for the class.
169      *
170      * @return a content tree for the member tree header
171      */
getMemberTreeHeader()172     Content getMemberTreeHeader();
173 
174     /**
175      * Returns a list to be used for the list of summaries for members of a given kind.
176      *
177      * @return a list to be used for the list of summaries for members of a given kind
178      */
getSummariesList()179     Content getSummariesList();
180 
181     /**
182      * Returns an item for the list of summaries for members of a given kind.
183      *
184      * @param content content for the item
185      * @return an item for the list of summaries for members of a given kind
186      */
getSummariesListItem(Content content)187     Content getSummariesListItem(Content content);
188 
189     /**
190      * Returns a list to be used for the list of details for members of a given kind.
191      *
192      * @return a list to be used for the list of details for members of a given kind
193      */
getDetailsList()194     Content getDetailsList();
195 
196     /**
197      * Returns an item for the list of details for members of a given kind.
198      *
199      * @param content content for the item
200      * @return an item for the list of details for members of a given kind
201      */
getDetailsListItem(Content content)202     Content getDetailsListItem(Content content);
203 
204     /**
205      * Add the class content tree.
206      *
207      * @param classContentTree class content tree which will be added to the content tree
208      */
addClassContentTree(Content classContentTree)209     void addClassContentTree(Content classContentTree);
210 
211     /**
212      * Add the footer of the page.
213      */
addFooter()214     void addFooter();
215 
216     /**
217      * Print the document.
218      *
219      * @param contentTree content tree that will be printed as a document
220      * @throws DocFileIOException if there is a problem while writing the document
221      */
printDocument(Content contentTree)222     void printDocument(Content contentTree) throws DocFileIOException;
223 
224     /**
225      * Return the TypeElement being documented.
226      *
227      * @return the TypeElement being documented.
228      */
getTypeElement()229     TypeElement getTypeElement();
230 
231     /**
232      * Get the member summary tree.
233      *
234      * @param memberTree the content tree used to build the summary tree
235      * @return a content tree for the member summary
236      */
getMemberSummaryTree(Content memberTree)237     Content getMemberSummaryTree(Content memberTree);
238 
239     /**
240      * Get the member details tree.
241      *
242      * @param memberTree the content tree used to build the details tree
243      * @return a content tree for the member details
244      */
getMemberDetailsTree(Content memberTree)245     Content getMemberDetailsTree(Content memberTree);
246 }
247