src/jdk.javadoc/share/classes/com/sun/javadoc/Tag.java
author ksrini
Fri, 09 Feb 2018 13:58:17 -0800
changeset 48840 5e2d2067da48
parent 47216 71c04702a3d5
permissions -rw-r--r--
8194651: javadoc: mark the com.sun.javadoc API for removal Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
48840
5e2d2067da48 8194651: javadoc: mark the com.sun.javadoc API for removal
ksrini
parents: 47216
diff changeset
     2
 * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 10
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.javadoc;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.text.BreakIterator;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
import java.util.Locale;
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * Represents a simple documentation tag, such as @since, @author, @version.
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since")
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * and tag text (e.g. "1.2").  Tags with structure or which require
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 * special processing are handled by subclasses such as ParamTag
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
    36
 * (for @param), SeeTag (for @see and {@link}), and ThrowsTag
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * (for @throws).
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * @see SeeTag
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * @see ParamTag
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * @see ThrowsTag
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * @see SerialFieldTag
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * @see Doc#tags()
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 *
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 25874
diff changeset
    47
 * @deprecated
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 25874
diff changeset
    48
 *   The declarations in this package have been superseded by those
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 25874
diff changeset
    49
 *   in the package {@code jdk.javadoc.doclet}.
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 25874
diff changeset
    50
 *   For more information, see the <i>Migration Guide</i> in the documentation for that package.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 */
48840
5e2d2067da48 8194651: javadoc: mark the com.sun.javadoc API for removal
ksrini
parents: 47216
diff changeset
    52
@Deprecated(since="9", forRemoval=true)
5e2d2067da48 8194651: javadoc: mark the com.sun.javadoc API for removal
ksrini
parents: 47216
diff changeset
    53
@SuppressWarnings("removal")
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
public interface Tag {
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
     * Return the name of this tag.  The name is the string
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * starting with "@" that is used in a doc comment, such as
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
    59
     * {@code @return}.  For inline tags, such as
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
    60
     * {@code {@link}}, the curly brackets
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
     * are not part of the name, so in this example the name
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
    62
     * would be simply {@code @link}.
18384
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
    63
     *
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
    64
     * @return the name of this tag
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    String name();
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
     * Return the containing {@link Doc} of this Tag element.
18384
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
    70
     *
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
    71
     * @return the containing {@link Doc} of this Tag element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    Doc holder();
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
     * Return the kind of this tag.
18384
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
    77
     * For most tags,
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
    78
     * {@code kind() == name()};
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     * the following table lists those cases where there is more
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
     * than one tag of a given kind:
21490
b839b14fe4eb 8027119: Cleanup javadoc comments for taglet API
jjg
parents: 18384
diff changeset
    81
     *
45866
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    82
     * <table class="striped">
44878
9dd9cf7919ff 8179299: Fix HTML 5 errors in java.compiler module
jjg
parents: 38617
diff changeset
    83
     * <caption>Related Tags</caption>
45866
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    84
     * <thead>
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    85
     * <tr><th scope="col">{@code name()  }  <th scope="col">{@code kind()      }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    86
     * </thead>
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    87
     * <tbody style="text-align:left">
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    88
     * <tr><th scope="row">{@code @exception  }  <td>{@code @throws }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    89
     * <tr><th scope="row">{@code @link       }  <td>{@code @see    }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    90
     * <tr><th scope="row">{@code @linkplain  }  <td>{@code @see    }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    91
     * <tr><th scope="row">{@code @see        }  <td>{@code @see    }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    92
     * <tr><th scope="row">{@code @serial     }  <td>{@code @serial }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    93
     * <tr><th scope="row">{@code @serialData }  <td>{@code @serial }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    94
     * <tr><th scope="row">{@code @throws     }  <td>{@code @throws }
5070422dda41 8184023: Fix tables in doc comments to be accessible
jjg
parents: 44878
diff changeset
    95
     * </tbody>
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     * </table>
18384
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
    97
     *
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
    98
     * @return the kind of this tag.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    String kind();
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    /**
18384
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
   103
     * Return the text of this tag, that is, the portion beyond tag name.
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
   104
     *
484bb5ccaa4a 8016193: Fix OAC issue in langtools docs
jjg
parents: 14259
diff changeset
   105
     * @return the text of this tag
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    String text();
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
     * Convert this object to a string.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    String toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
    /**
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   115
     * For a documentation comment with embedded {@code {@link}}
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   116
     * tags, return an array of {@code Tag} objects.  The entire
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
     * doc comment is broken down into strings separated by
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   118
     * {@code {@link}} tags, where each successive element
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     * of the array represents either a string or
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   120
     * {@code {@link}} tag, in order, from start to end.
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   121
     * Each string is represented by a {@code Tag} object of
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
     * name "Text", where {@link #text()} returns the string.  Each
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   123
     * {@code {@link}} tag is represented by a
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     * {@link SeeTag} of name "@link" and kind "@see".
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
     * For example, given the following comment
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
     * tag:
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
     * <p>
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   128
     *  {@code This is a {@link Doc commentlabel} example.}
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
     * return an array of Tag objects:
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
     * <ul>
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     *    <li> tags[0] is a {@link Tag} with name "Text" and text consisting
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     *         of "This is a "
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     *    <li> tags[1] is a {@link SeeTag} with name "@link", referenced
23137
209daac13c8b 8035878: javadoc tool documentation should be using {@code ..} specifier
jjg
parents: 21490
diff changeset
   135
     *         class {@code Doc} and label "commentlabel"
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     *    <li> tags[2] is a {@link Tag} with name "Text" and text consisting
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
     *         of " example."
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
     * </ul>
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     * @return Tag[] array of tags
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
     * @see ParamTag
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
     * @see ThrowsTag
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
    Tag[] inlineTags();
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
     * Return the first sentence of the comment as an array of tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     * Includes inline tags
13844
56339cf983a3 7177970: fix issues in langtools doc comments
jjg
parents: 5520
diff changeset
   149
     * (i.e. {&#64;link <i>reference</i>} tags)  but not
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     * block tags.
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
     * Each section of plain text is represented as a {@link Tag}
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     * of kind "Text".
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
     * Inline tags are represented as a {@link SeeTag} of kind "@link".
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * If the locale is English language, the first sentence is
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     * determined by the rules described in the Java Language
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     * Specification (first version): &quot;This sentence ends
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
     * at the first period that is followed by a blank, tab, or
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
     * line terminator or at the first tagline.&quot;, in
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
     * addition a line will be terminated by paragraph and
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * section terminating HTML tags: &lt;p&gt;  &lt;/p&gt;  &lt;h1&gt;
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     * &lt;h2&gt;  &lt;h3&gt; &lt;h4&gt;  &lt;h5&gt;  &lt;h6&gt;
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
     * &lt;hr&gt;  &lt;pre&gt;  or &lt;/pre&gt;.
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
     * If the locale is not English, the sentence end will be
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     * determined by
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     * {@link BreakIterator#getSentenceInstance(Locale)}.
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     * @return an array of {@link Tag} objects representing the
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     *         first sentence of the comment
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    Tag[] firstSentenceTags();
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
     * Return the source position of this tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
     * @return the source position of this tag.
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
    public SourcePosition position();
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
}