1 /*
2  * Copyright (c) 2003, 2016, 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  * @author Jamie Ho
41  * @author Bhavesh Patel (Modified)
42  */
43 
44 public interface ClassWriter {
45 
46     /**
47      * Get the header of the page.
48      *
49      * @param header the header string to write
50      * @return header content that needs to be added to the documentation
51      */
getHeader(String header)52     public Content getHeader(String header);
53 
54     /**
55      * Get the class content header.
56      *
57      * @return class content header that needs to be added to the documentation
58      */
getClassContentHeader()59     public Content getClassContentHeader();
60 
61     /**
62      * Add the class tree documentation.
63      *
64      * @param classContentTree class content tree to which the documentation will be added
65      */
addClassTree(Content classContentTree)66     public void addClassTree(Content classContentTree);
67 
68     /**
69      * Get the class information tree header.
70      *
71      * @return class informaion tree header that needs to be added to the documentation
72      */
getClassInfoTreeHeader()73     public Content getClassInfoTreeHeader();
74 
75     /**
76      * Add the type parameter information.
77      *
78      * @param classInfoTree content tree to which the documentation will be added
79      */
addTypeParamInfo(Content classInfoTree)80     public void addTypeParamInfo(Content classInfoTree);
81 
82     /**
83      * Add all super interfaces if this is an interface.
84      *
85      * @param classInfoTree content tree to which the documentation will be added
86      */
addSuperInterfacesInfo(Content classInfoTree)87     public void addSuperInterfacesInfo(Content classInfoTree);
88 
89     /**
90      * Add all implemented interfaces if this is a class.
91      *
92      * @param classInfoTree content tree to which the documentation will be added
93      */
addImplementedInterfacesInfo(Content classInfoTree)94     public void addImplementedInterfacesInfo(Content classInfoTree);
95 
96     /**
97      * Add all the classes that extend this one.
98      *
99      * @param classInfoTree content tree to which the documentation will be added
100      */
addSubClassInfo(Content classInfoTree)101     public void addSubClassInfo(Content classInfoTree);
102 
103     /**
104      * Add all the interfaces that extend this one.
105      *
106      * @param classInfoTree content tree to which the documentation will be added
107      */
addSubInterfacesInfo(Content classInfoTree)108     public void addSubInterfacesInfo(Content classInfoTree);
109 
110     /**
111      * If this is an interface, add all classes that implement this
112      * interface.
113      *
114      * @param classInfoTree content tree to which the documentation will be added
115      */
addInterfaceUsageInfo(Content classInfoTree)116     public void addInterfaceUsageInfo(Content classInfoTree);
117 
118     /**
119      * If this is an functional interface, display appropriate message.
120      *
121      * @param classInfoTree content tree to which the documentation will be added
122      */
addFunctionalInterfaceInfo(Content classInfoTree)123     public void addFunctionalInterfaceInfo(Content classInfoTree);
124 
125     /**
126      * If this is an inner class or interface, add the enclosing class or
127      * interface.
128      *
129      * @param classInfoTree content tree to which the documentation will be added
130      */
addNestedClassInfo(Content classInfoTree)131     public void addNestedClassInfo (Content classInfoTree);
132 
133     /**
134      * Get the class information.
135      *
136      * @param classInfoTree content tree conatining the class information
137      * @return a content tree for the class
138      */
getClassInfo(Content classInfoTree)139     public Content getClassInfo(Content classInfoTree);
140 
141     /**
142      * If this class is deprecated, add the appropriate information.
143      *
144      * @param classInfoTree content tree to which the documentation will be added
145      */
addClassDeprecationInfo(Content classInfoTree)146     public void addClassDeprecationInfo (Content classInfoTree);
147 
148     /**
149      * Add the signature of the current class content tree.
150      *
151      * @param modifiers the modifiers for the signature
152      * @param classInfoTree the class content tree to which the signature will be added
153      */
addClassSignature(String modifiers, Content classInfoTree)154     public void addClassSignature(String modifiers, Content classInfoTree);
155 
156     /**
157      * Build the class description.
158      *
159      * @param classInfoTree content tree to which the documentation will be added
160      */
addClassDescription(Content classInfoTree)161     public void addClassDescription(Content classInfoTree);
162 
163     /**
164      * Add the tag information for the current class.
165      *
166      * @param classInfoTree content tree to which the tag information will be added
167      */
addClassTagInfo(Content classInfoTree)168     public void addClassTagInfo(Content classInfoTree);
169 
170     /**
171      * Get the member tree header for the class.
172      *
173      * @return a content tree for the member tree header
174      */
getMemberTreeHeader()175     public Content getMemberTreeHeader();
176 
177     /**
178      * Add the class content tree.
179      *
180      * @param contentTree content tree to which the class content will be added
181      * @param classContentTree class content tree which will be added to the content tree
182      */
addClassContentTree(Content contentTree, Content classContentTree)183     public void addClassContentTree(Content contentTree, Content classContentTree);
184 
185     /**
186      * Add the footer of the page.
187      *
188      * @param contentTree content tree to which the footer will be added
189      */
addFooter(Content contentTree)190     public void addFooter(Content contentTree);
191 
192     /**
193      * Print the document.
194      *
195      * @param contentTree content tree that will be printed as a document
196      * @throws DocFileIOException if there is a problem while writing the document
197      */
printDocument(Content contentTree)198     public void printDocument(Content contentTree) throws DocFileIOException;
199 
200     /**
201      * Return the TypeElement being documented.
202      *
203      * @return the TypeElement being documented.
204      */
getTypeElement()205     public TypeElement getTypeElement();
206 
207     /**
208      * Get the member summary tree.
209      *
210      * @param memberTree the content tree used to build the summary tree
211      * @return a content tree for the member summary
212      */
getMemberSummaryTree(Content memberTree)213     public Content getMemberSummaryTree(Content memberTree);
214 
215     /**
216      * Get the member details tree.
217      *
218      * @param memberTree the content tree used to build the details tree
219      * @return a content tree for the member details
220      */
getMemberDetailsTree(Content memberTree)221     public Content getMemberDetailsTree(Content memberTree);
222 }
223