1 /* |
|
2 * Copyright (c) 1998, 2018, 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 com.sun.javadoc; |
|
27 |
|
28 import java.text.BreakIterator; |
|
29 import java.util.Locale; |
|
30 |
|
31 /** |
|
32 * Represents a simple documentation tag, such as @since, @author, @version. |
|
33 * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since") |
|
34 * and tag text (e.g. "1.2"). Tags with structure or which require |
|
35 * special processing are handled by subclasses such as ParamTag |
|
36 * (for @param), SeeTag (for @see and {@link}), and ThrowsTag |
|
37 * (for @throws). |
|
38 * |
|
39 * @author Robert Field |
|
40 * @author Atul M Dambalkar |
|
41 * @see SeeTag |
|
42 * @see ParamTag |
|
43 * @see ThrowsTag |
|
44 * @see SerialFieldTag |
|
45 * @see Doc#tags() |
|
46 * |
|
47 * @deprecated |
|
48 * The declarations in this package have been superseded by those |
|
49 * in the package {@code jdk.javadoc.doclet}. |
|
50 * For more information, see the <i>Migration Guide</i> in the documentation for that package. |
|
51 */ |
|
52 @Deprecated(since="9", forRemoval=true) |
|
53 @SuppressWarnings("removal") |
|
54 public interface Tag { |
|
55 |
|
56 /** |
|
57 * Return the name of this tag. The name is the string |
|
58 * starting with "@" that is used in a doc comment, such as |
|
59 * {@code @return}. For inline tags, such as |
|
60 * {@code {@link}}, the curly brackets |
|
61 * are not part of the name, so in this example the name |
|
62 * would be simply {@code @link}. |
|
63 * |
|
64 * @return the name of this tag |
|
65 */ |
|
66 String name(); |
|
67 |
|
68 /** |
|
69 * Return the containing {@link Doc} of this Tag element. |
|
70 * |
|
71 * @return the containing {@link Doc} of this Tag element |
|
72 */ |
|
73 Doc holder(); |
|
74 |
|
75 /** |
|
76 * Return the kind of this tag. |
|
77 * For most tags, |
|
78 * {@code kind() == name()}; |
|
79 * the following table lists those cases where there is more |
|
80 * than one tag of a given kind: |
|
81 * |
|
82 * <table class="striped"> |
|
83 * <caption>Related Tags</caption> |
|
84 * <thead> |
|
85 * <tr><th scope="col">{@code name() } <th scope="col">{@code kind() } |
|
86 * </thead> |
|
87 * <tbody style="text-align:left"> |
|
88 * <tr><th scope="row">{@code @exception } <td>{@code @throws } |
|
89 * <tr><th scope="row">{@code @link } <td>{@code @see } |
|
90 * <tr><th scope="row">{@code @linkplain } <td>{@code @see } |
|
91 * <tr><th scope="row">{@code @see } <td>{@code @see } |
|
92 * <tr><th scope="row">{@code @serial } <td>{@code @serial } |
|
93 * <tr><th scope="row">{@code @serialData } <td>{@code @serial } |
|
94 * <tr><th scope="row">{@code @throws } <td>{@code @throws } |
|
95 * </tbody> |
|
96 * </table> |
|
97 * |
|
98 * @return the kind of this tag. |
|
99 */ |
|
100 String kind(); |
|
101 |
|
102 /** |
|
103 * Return the text of this tag, that is, the portion beyond tag name. |
|
104 * |
|
105 * @return the text of this tag |
|
106 */ |
|
107 String text(); |
|
108 |
|
109 /** |
|
110 * Convert this object to a string. |
|
111 */ |
|
112 String toString(); |
|
113 |
|
114 /** |
|
115 * For a documentation comment with embedded {@code {@link}} |
|
116 * tags, return an array of {@code Tag} objects. The entire |
|
117 * doc comment is broken down into strings separated by |
|
118 * {@code {@link}} tags, where each successive element |
|
119 * of the array represents either a string or |
|
120 * {@code {@link}} tag, in order, from start to end. |
|
121 * Each string is represented by a {@code Tag} object of |
|
122 * name "Text", where {@link #text()} returns the string. Each |
|
123 * {@code {@link}} tag is represented by a |
|
124 * {@link SeeTag} of name "@link" and kind "@see". |
|
125 * For example, given the following comment |
|
126 * tag: |
|
127 * <p> |
|
128 * {@code This is a {@link Doc commentlabel} example.} |
|
129 * <p> |
|
130 * return an array of Tag objects: |
|
131 * <ul> |
|
132 * <li> tags[0] is a {@link Tag} with name "Text" and text consisting |
|
133 * of "This is a " |
|
134 * <li> tags[1] is a {@link SeeTag} with name "@link", referenced |
|
135 * class {@code Doc} and label "commentlabel" |
|
136 * <li> tags[2] is a {@link Tag} with name "Text" and text consisting |
|
137 * of " example." |
|
138 * </ul> |
|
139 * |
|
140 * @return Tag[] array of tags |
|
141 * @see ParamTag |
|
142 * @see ThrowsTag |
|
143 */ |
|
144 Tag[] inlineTags(); |
|
145 |
|
146 /** |
|
147 * Return the first sentence of the comment as an array of tags. |
|
148 * Includes inline tags |
|
149 * (i.e. {@link <i>reference</i>} tags) but not |
|
150 * block tags. |
|
151 * Each section of plain text is represented as a {@link Tag} |
|
152 * of kind "Text". |
|
153 * Inline tags are represented as a {@link SeeTag} of kind "@link". |
|
154 * If the locale is English language, the first sentence is |
|
155 * determined by the rules described in the Java Language |
|
156 * Specification (first version): "This sentence ends |
|
157 * at the first period that is followed by a blank, tab, or |
|
158 * line terminator or at the first tagline.", in |
|
159 * addition a line will be terminated by paragraph and |
|
160 * section terminating HTML tags: <p> </p> <h1> |
|
161 * <h2> <h3> <h4> <h5> <h6> |
|
162 * <hr> <pre> or </pre>. |
|
163 * If the locale is not English, the sentence end will be |
|
164 * determined by |
|
165 * {@link BreakIterator#getSentenceInstance(Locale)}. |
|
166 * |
|
167 * @return an array of {@link Tag} objects representing the |
|
168 * first sentence of the comment |
|
169 */ |
|
170 Tag[] firstSentenceTags(); |
|
171 |
|
172 /** |
|
173 * Return the source position of this tag. |
|
174 * @return the source position of this tag. |
|
175 */ |
|
176 public SourcePosition position(); |
|
177 } |
|