src/share/classes/com/sun/javadoc/Tag.java

Tue, 24 Dec 2013 09:17:37 -0800

author
ksrini
date
Tue, 24 Dec 2013 09:17:37 -0800
changeset 2227
998b10c43157
parent 2159
351d6808c1a5
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8029230: Update copyright year to match last edit in jdk8 langtools repository for 2013
Reviewed-by: ksrini
Contributed-by: steve.sides@oracle.com

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

mercurial