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     public 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     public 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     public void addClassTree(Content classContentTree);
64 
65     /**
66      * Get the class information tree header.
67      *
68      * @return class informaion tree header that needs to be added to the documentation
69      */
getClassInfoTreeHeader()70     public 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     public 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     public 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     public 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     public 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     public 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     public 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     public 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     public void addNestedClassInfo (Content classInfoTree);
129 
130     /**
131      * Get the class information.
132      *
133      * @param classInfoTree content tree conatining the class information
134      * @return a content tree for the class
135      */
getClassInfo(Content classInfoTree)136     public 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     public 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     public 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     public 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     public 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     public Content getMemberTreeHeader();
173 
174     /**
175      * Add the class content tree.
176      *
177      * @param classContentTree class content tree which will be added to the content tree
178      */
addClassContentTree(Content classContentTree)179     public void addClassContentTree(Content classContentTree);
180 
181     /**
182      * Add the footer of the page.
183      */
addFooter()184     public void addFooter();
185 
186     /**
187      * Print the document.
188      *
189      * @param contentTree content tree that will be printed as a document
190      * @throws DocFileIOException if there is a problem while writing the document
191      */
printDocument(Content contentTree)192     public void printDocument(Content contentTree) throws DocFileIOException;
193 
194     /**
195      * Return the TypeElement being documented.
196      *
197      * @return the TypeElement being documented.
198      */
getTypeElement()199     public TypeElement getTypeElement();
200 
201     /**
202      * Get the member summary tree.
203      *
204      * @param memberTree the content tree used to build the summary tree
205      * @return a content tree for the member summary
206      */
getMemberSummaryTree(Content memberTree)207     public Content getMemberSummaryTree(Content memberTree);
208 
209     /**
210      * Get the member details tree.
211      *
212      * @param memberTree the content tree used to build the details tree
213      * @return a content tree for the member details
214      */
getMemberDetailsTree(Content memberTree)215     public Content getMemberDetailsTree(Content memberTree);
216 }
217