Wed, 10 Oct 2012 16:48:21 -0700
8000665: fix "internal API" comments on javadoc files
Reviewed-by: darcy
1 /*
2 * Copyright (c) 2010, 2012, 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 */
26 package com.sun.tools.doclets.formats.html.markup;
28 import com.sun.tools.doclets.internal.toolkit.Content;
29 import com.sun.tools.doclets.internal.toolkit.util.*;
31 /**
32 * Class for generating string content for HTML tags of javadoc output.
33 *
34 * <p><b>This is NOT part of any supported API.
35 * If you write code that depends on this, you do so at your own risk.
36 * This code and its internal interfaces are subject to change or
37 * deletion without notice.</b>
38 *
39 * @author Bhavesh Patel
40 */
41 public class StringContent extends Content{
43 private StringBuilder stringContent;
45 /**
46 * Constructor to construct StringContent object.
47 */
48 public StringContent() {
49 stringContent = new StringBuilder();
50 }
52 /**
53 * Constructor to construct StringContent object with some initial content.
54 *
55 * @param initialContent initial content for the object
56 */
57 public StringContent(String initialContent) {
58 stringContent = new StringBuilder(
59 Util.escapeHtmlChars(nullCheck(initialContent)));
60 }
62 /**
63 * This method is not supported by the class.
64 *
65 * @param content content that needs to be added
66 * @throws DocletAbortException this method will always throw a
67 * DocletAbortException because it
68 * is not supported.
69 */
70 public void addContent(Content content) {
71 throw new DocletAbortException();
72 }
74 /**
75 * Adds content for the StringContent object. The method escapes
76 * HTML characters for the string content that is added.
77 *
78 * @param strContent string content to be added
79 */
80 public void addContent(String strContent) {
81 stringContent.append(Util.escapeHtmlChars(nullCheck(strContent)));
82 }
84 /**
85 * {@inheritDoc}
86 */
87 public boolean isEmpty() {
88 return (stringContent.length() == 0);
89 }
91 /**
92 * {@inheritDoc}
93 */
94 public String toString() {
95 return stringContent.toString();
96 }
98 /**
99 * {@inheritDoc}
100 */
101 public void write(StringBuilder contentBuilder) {
102 contentBuilder.append(stringContent);
103 }
104 }