src/share/classes/com/sun/tools/doclets/internal/toolkit/util/TextTag.java

changeset 1
9a66ca7c79fa
child 554
9d9f26857129
equal deleted inserted replaced
-1:000000000000 1:9a66ca7c79fa
1 /*
2 * Copyright 2003 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25 package com.sun.tools.doclets.internal.toolkit.util;
26 import com.sun.javadoc.*;
27
28
29 /**
30 * A tag that holds nothing but plain text. This is useful for passing
31 * text to methods that only accept inline tags as a parameter.
32 *
33 * This code is not part of an API.
34 * It is implementation that is subject to change.
35 * Do not use it as an API
36 *
37 * @author Jamie Ho
38 * @since 1.5
39 */
40 public class TextTag implements Tag {
41 protected final String text;
42 protected final String name = "Text";
43 protected final Doc holder;
44
45 /**
46 * Constructor
47 */
48 public TextTag(Doc holder, String text) {
49 super();
50 this.holder = holder;
51 this.text = text;
52 }
53
54 /**
55 * {@inheritDoc}
56 */
57 public String name() {
58 return name;
59 }
60
61 /**
62 * {@inheritDoc}
63 */
64 public Doc holder() {
65 return holder;
66 }
67
68 /**
69 * {@inheritDoc}
70 */
71 public String kind() {
72 return name;
73 }
74
75 /**
76 * {@inheritDoc}
77 */
78 public String text() {
79 return text;
80 }
81
82 /**
83 * {@inheritDoc}
84 */
85 public String toString() {
86 return name + ":" + text;
87 }
88
89 /**
90 * {@inheritDoc}
91 */
92 public Tag[] inlineTags() {
93 return new Tag[] {this};
94 }
95
96 /**
97 * {@inheritDoc}
98 */
99 public Tag[] firstSentenceTags() {
100 return new Tag[] {this};
101 }
102
103 /**
104 * {@inheritDoc}
105 */
106 public SourcePosition position() {
107 return holder.position();
108 }
109 }

mercurial