Mon, 15 Oct 2012 17:07:55 -0700
8000666: javadoc should write directly to Writer instead of composing strings
Reviewed-by: bpatel
duke@1 | 1 | /* |
jjg@1359 | 2 | * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@554 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@554 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
ohair@554 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | package com.sun.tools.doclets.internal.toolkit; |
duke@1 | 27 | |
bpatel@233 | 28 | import java.io.*; |
bpatel@233 | 29 | |
duke@1 | 30 | import com.sun.javadoc.*; |
duke@1 | 31 | |
duke@1 | 32 | /** |
duke@1 | 33 | * The interface for writing serialized form output. |
duke@1 | 34 | * |
jjg@1359 | 35 | * <p><b>This is NOT part of any supported API. |
jjg@1359 | 36 | * If you write code that depends on this, you do so at your own risk. |
jjg@1359 | 37 | * This code and its internal interfaces are subject to change or |
jjg@1359 | 38 | * deletion without notice.</b> |
duke@1 | 39 | * |
duke@1 | 40 | * @author Jamie Ho |
duke@1 | 41 | * @since 1.5 |
duke@1 | 42 | */ |
duke@1 | 43 | |
duke@1 | 44 | public interface SerializedFormWriter { |
duke@1 | 45 | |
duke@1 | 46 | /** |
bpatel@766 | 47 | * Get the header. |
duke@1 | 48 | * |
duke@1 | 49 | * @param header the header to write. |
bpatel@766 | 50 | * @return the header content tree |
duke@1 | 51 | */ |
bpatel@766 | 52 | public Content getHeader(String header); |
duke@1 | 53 | |
duke@1 | 54 | /** |
bpatel@766 | 55 | * Get the serialized form summaries header. |
duke@1 | 56 | * |
bpatel@766 | 57 | * @return the serialized form summary header tree |
duke@1 | 58 | */ |
bpatel@766 | 59 | public Content getSerializedSummariesHeader(); |
duke@1 | 60 | |
duke@1 | 61 | /** |
bpatel@766 | 62 | * Get the package serialized form header. |
duke@1 | 63 | * |
bpatel@766 | 64 | * @return the package serialized form header tree |
duke@1 | 65 | */ |
bpatel@766 | 66 | public Content getPackageSerializedHeader(); |
duke@1 | 67 | |
duke@1 | 68 | /** |
bpatel@766 | 69 | * Get the given package header. |
bpatel@766 | 70 | * |
bpatel@766 | 71 | * @param packageName the package header to write |
bpatel@766 | 72 | * @return a content tree for the package header |
bpatel@766 | 73 | */ |
bpatel@766 | 74 | public Content getPackageHeader(String packageName); |
bpatel@766 | 75 | |
bpatel@766 | 76 | /** |
bpatel@766 | 77 | * Get the serialized class header. |
bpatel@766 | 78 | * |
bpatel@766 | 79 | * @return a content tree for the serialized class header |
bpatel@766 | 80 | */ |
bpatel@766 | 81 | public Content getClassSerializedHeader(); |
bpatel@766 | 82 | |
bpatel@766 | 83 | /** |
bpatel@766 | 84 | * Get the heading for the serializable class. |
bpatel@766 | 85 | * |
bpatel@766 | 86 | * @param classDoc the class being processed |
bpatel@766 | 87 | * @return a content tree for the class heading |
bpatel@766 | 88 | */ |
bpatel@766 | 89 | public Content getClassHeader(ClassDoc classDoc); |
bpatel@766 | 90 | |
bpatel@766 | 91 | /** |
bpatel@766 | 92 | * Get the serial UID info header. |
bpatel@766 | 93 | * |
bpatel@766 | 94 | * @return a content tree for the serial uid info header |
bpatel@766 | 95 | */ |
bpatel@766 | 96 | public Content getSerialUIDInfoHeader(); |
bpatel@766 | 97 | |
bpatel@766 | 98 | /** |
bpatel@766 | 99 | * Adds the serial UID info. |
duke@1 | 100 | * |
duke@1 | 101 | * @param header the header that will show up before the UID. |
duke@1 | 102 | * @param serialUID the serial UID to print. |
bpatel@766 | 103 | * @param serialUidTree the serial UID tree to which the content will be added. |
duke@1 | 104 | */ |
bpatel@766 | 105 | public void addSerialUIDInfo(String header, String serialUID, |
bpatel@766 | 106 | Content serialUidTree); |
bpatel@766 | 107 | |
bpatel@766 | 108 | /** |
bpatel@766 | 109 | * Get the class serialize content header. |
bpatel@766 | 110 | * |
bpatel@766 | 111 | * @return a content tree for the class serialize content header |
bpatel@766 | 112 | */ |
bpatel@766 | 113 | public Content getClassContentHeader(); |
duke@1 | 114 | |
duke@1 | 115 | /** |
duke@1 | 116 | * Return an instance of a SerialFieldWriter. |
duke@1 | 117 | * |
duke@1 | 118 | * @return an instance of a SerialFieldWriter. |
duke@1 | 119 | */ |
duke@1 | 120 | public SerialFieldWriter getSerialFieldWriter(ClassDoc classDoc); |
duke@1 | 121 | |
duke@1 | 122 | /** |
duke@1 | 123 | * Return an instance of a SerialMethodWriter. |
duke@1 | 124 | * |
duke@1 | 125 | * @return an instance of a SerialMethodWriter. |
duke@1 | 126 | */ |
duke@1 | 127 | public SerialMethodWriter getSerialMethodWriter(ClassDoc classDoc); |
duke@1 | 128 | |
duke@1 | 129 | /** |
duke@1 | 130 | * Close the writer. |
duke@1 | 131 | */ |
duke@1 | 132 | public abstract void close() throws IOException; |
duke@1 | 133 | |
duke@1 | 134 | /** |
bpatel@766 | 135 | * Get the serialized content. |
bpatel@766 | 136 | * |
bpatel@766 | 137 | * @param serializedTreeContent content for serialized data |
bpatel@766 | 138 | * @return a content tree for serialized information |
duke@1 | 139 | */ |
bpatel@766 | 140 | public Content getSerializedContent(Content serializedTreeContent); |
bpatel@766 | 141 | |
bpatel@766 | 142 | /** |
bpatel@766 | 143 | * Add the footer. |
bpatel@766 | 144 | * |
bpatel@766 | 145 | * @param serializedTree the serialized tree to be added |
bpatel@766 | 146 | */ |
bpatel@766 | 147 | public void addFooter(Content serializedTree); |
bpatel@766 | 148 | |
bpatel@766 | 149 | /** |
bpatel@766 | 150 | * Print the serialized form document. |
bpatel@766 | 151 | * |
bpatel@766 | 152 | * @param serializedTree the content tree that will be printed |
bpatel@766 | 153 | */ |
jjg@1364 | 154 | public abstract void printDocument(Content serializedTree) throws IOException; |
duke@1 | 155 | |
duke@1 | 156 | /** |
duke@1 | 157 | * Write the serialized form for a given field. |
duke@1 | 158 | */ |
duke@1 | 159 | public interface SerialFieldWriter { |
duke@1 | 160 | |
duke@1 | 161 | /** |
bpatel@766 | 162 | * Get the serializable field header. |
bpatel@766 | 163 | * |
bpatel@766 | 164 | * @return serialized fields header content tree |
bpatel@766 | 165 | */ |
bpatel@766 | 166 | public Content getSerializableFieldsHeader(); |
bpatel@766 | 167 | |
bpatel@766 | 168 | /** |
bpatel@766 | 169 | * Get the field content header. |
bpatel@766 | 170 | * |
bpatel@766 | 171 | * @param isLastContent true if this is the last content to be documented |
bpatel@766 | 172 | * @return fields header content tree |
bpatel@766 | 173 | */ |
bpatel@766 | 174 | public Content getFieldsContentHeader(boolean isLastContent); |
bpatel@766 | 175 | |
bpatel@766 | 176 | /** |
bpatel@766 | 177 | * Get the fields content. |
duke@1 | 178 | * |
duke@1 | 179 | * @param heading the heading to write. |
bpatel@766 | 180 | * @param contentTree content tree to which the heading will be added |
bpatel@766 | 181 | * @return serializable fields content tree |
duke@1 | 182 | */ |
bpatel@766 | 183 | public Content getSerializableFields(String heading, Content contentTree); |
duke@1 | 184 | |
duke@1 | 185 | /** |
bpatel@766 | 186 | * Adds the deprecated information for this member. |
duke@1 | 187 | * |
duke@1 | 188 | * @param field the field to document. |
bpatel@766 | 189 | * @param contentTree content tree to which the deprecated information will be added |
duke@1 | 190 | */ |
bpatel@766 | 191 | public void addMemberDeprecatedInfo(FieldDoc field, Content contentTree); |
duke@1 | 192 | |
duke@1 | 193 | /** |
bpatel@766 | 194 | * Adds the description text for this member. |
duke@1 | 195 | * |
duke@1 | 196 | * @param field the field to document. |
bpatel@766 | 197 | * @param contentTree content tree to which the member description will be added |
duke@1 | 198 | */ |
bpatel@766 | 199 | public void addMemberDescription(FieldDoc field, Content contentTree); |
duke@1 | 200 | |
duke@1 | 201 | /** |
bpatel@766 | 202 | * Adds the description text for this member represented by the tag. |
duke@1 | 203 | * |
duke@1 | 204 | * @param serialFieldTag the field to document (represented by tag). |
bpatel@766 | 205 | * @param contentTree content tree to which the member description will be added |
duke@1 | 206 | */ |
bpatel@766 | 207 | public void addMemberDescription(SerialFieldTag serialFieldTag, Content contentTree); |
duke@1 | 208 | |
duke@1 | 209 | /** |
bpatel@766 | 210 | * Adds the tag information for this member. |
duke@1 | 211 | * |
duke@1 | 212 | * @param field the field to document. |
bpatel@766 | 213 | * @param contentTree content tree to which the member tags will be added |
duke@1 | 214 | */ |
bpatel@766 | 215 | public void addMemberTags(FieldDoc field, Content contentTree); |
duke@1 | 216 | |
duke@1 | 217 | /** |
bpatel@766 | 218 | * Adds the member header. |
duke@1 | 219 | * |
duke@1 | 220 | * @param fieldType the type of the field. |
duke@1 | 221 | * @param fieldTypeStr the type of the field in string format. We will |
duke@1 | 222 | * print this out if we can't link to the type. |
duke@1 | 223 | * @param fieldDimensions the dimensions of the field. |
duke@1 | 224 | * @param fieldName the name of the field. |
bpatel@766 | 225 | * @param contentTree content tree to which the member header will be added |
duke@1 | 226 | */ |
bpatel@766 | 227 | public void addMemberHeader(ClassDoc fieldType, String fieldTypeStr, |
bpatel@766 | 228 | String fieldDimensions, String fieldName, Content contentTree); |
bpatel@233 | 229 | |
bpatel@233 | 230 | /** |
bpatel@233 | 231 | * Check to see if overview details should be printed. If |
bpatel@233 | 232 | * nocomment option set or if there is no text to be printed |
bpatel@233 | 233 | * for deprecation info, inline comment or tags, |
bpatel@233 | 234 | * do not print overview details. |
bpatel@233 | 235 | * |
bpatel@233 | 236 | * @param field the field to check overview details for. |
bpatel@233 | 237 | * @return true if overview details need to be printed |
bpatel@233 | 238 | */ |
bpatel@233 | 239 | public boolean shouldPrintOverview(FieldDoc field); |
duke@1 | 240 | } |
duke@1 | 241 | |
duke@1 | 242 | /** |
duke@1 | 243 | * Write the serialized form for a given field. |
duke@1 | 244 | */ |
duke@1 | 245 | public interface SerialMethodWriter { |
duke@1 | 246 | |
duke@1 | 247 | /** |
bpatel@766 | 248 | * Get the serializable method header. |
bpatel@766 | 249 | * |
bpatel@766 | 250 | * @return serializable methods content tree |
bpatel@766 | 251 | */ |
bpatel@766 | 252 | public Content getSerializableMethodsHeader(); |
bpatel@766 | 253 | |
bpatel@766 | 254 | /** |
bpatel@766 | 255 | * Get the method content header. |
bpatel@766 | 256 | * |
bpatel@766 | 257 | * @param isLastContent true if this is the last content to be documented |
bpatel@766 | 258 | * @return methods content tree |
bpatel@766 | 259 | */ |
bpatel@766 | 260 | public Content getMethodsContentHeader(boolean isLastContent); |
bpatel@766 | 261 | |
bpatel@766 | 262 | /** |
duke@1 | 263 | * Write the given heading. |
duke@1 | 264 | * |
bpatel@766 | 265 | * @param heading the heading to write |
bpatel@766 | 266 | * @param serializableMethodTree content tree which will be added |
bpatel@766 | 267 | * @return serializable methods content tree |
duke@1 | 268 | */ |
bpatel@766 | 269 | public Content getSerializableMethods(String heading, Content serializableMethodTree); |
duke@1 | 270 | |
duke@1 | 271 | /** |
duke@1 | 272 | * Write a warning that no serializable methods exist. |
duke@1 | 273 | * |
bpatel@766 | 274 | * @param msg the warning to print |
bpatel@766 | 275 | * @return no customization message tree |
duke@1 | 276 | */ |
bpatel@766 | 277 | public Content getNoCustomizationMsg(String msg); |
duke@1 | 278 | |
duke@1 | 279 | /** |
bpatel@766 | 280 | * Adds the header. |
duke@1 | 281 | * |
bpatel@766 | 282 | * @param member the member to write the header for |
bpatel@766 | 283 | * @param methodsContentTree content tree to which the header will be added |
duke@1 | 284 | */ |
bpatel@766 | 285 | public void addMemberHeader(MethodDoc member, Content methodsContentTree); |
duke@1 | 286 | |
duke@1 | 287 | /** |
bpatel@766 | 288 | * Adds the deprecated information for this member. |
bpatel@766 | 289 | * |
bpatel@766 | 290 | * @param member the member to write the deprecated information for |
bpatel@766 | 291 | * @param methodsContentTree content tree to which the deprecated |
bpatel@766 | 292 | * information will be added |
duke@1 | 293 | */ |
bpatel@766 | 294 | public void addDeprecatedMemberInfo(MethodDoc member, Content methodsContentTree); |
duke@1 | 295 | |
duke@1 | 296 | /** |
bpatel@766 | 297 | * Adds the description for this member. |
bpatel@766 | 298 | * |
bpatel@766 | 299 | * @param member the member to write the information for |
bpatel@766 | 300 | * @param methodsContentTree content tree to which the member |
bpatel@766 | 301 | * information will be added |
duke@1 | 302 | */ |
bpatel@766 | 303 | public void addMemberDescription(MethodDoc member, Content methodsContentTree); |
duke@1 | 304 | |
duke@1 | 305 | /** |
bpatel@766 | 306 | * Adds the tag information for this member. |
bpatel@766 | 307 | * |
bpatel@766 | 308 | * @param member the member to write the tags information for |
bpatel@766 | 309 | * @param methodsContentTree content tree to which the tags |
bpatel@766 | 310 | * information will be added |
duke@1 | 311 | */ |
bpatel@766 | 312 | public void addMemberTags(MethodDoc member, Content methodsContentTree); |
duke@1 | 313 | } |
duke@1 | 314 | } |