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

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
9a66ca7c79fa
child 554
9d9f26857129
permissions
-rw-r--r--

Initial load

duke@1 1 /*
duke@1 2 * Copyright 1998-2006 Sun Microsystems, Inc. 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
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun 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 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any 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>.
duke@1 57 */
duke@1 58 String name();
duke@1 59
duke@1 60 /**
duke@1 61 * Return the containing {@link Doc} of this Tag element.
duke@1 62 */
duke@1 63 Doc holder();
duke@1 64
duke@1 65 /**
duke@1 66 * Return the kind of this tag.
duke@1 67 * similar or synonymous tags. For most tags,
duke@1 68 * <code>kind()&nbsp;==&nbsp;name()</code>;
duke@1 69 * the following table lists those cases where there is more
duke@1 70 * than one tag of a given kind:
duke@1 71 * <p>
duke@1 72 * <table border="1" cellpadding="4" cellspacing="0">
duke@1 73 * <tr><th><tt> kind() </th> <th><tt> name() </th></tr>
duke@1 74 * <tr><td><tt> @throws </td> <td><tt> @throws </td></tr>
duke@1 75 * <tr><td><tt> @throws </td> <td><tt> @exception </td></tr>
duke@1 76 * <tr><td><tt> @see </td> <td><tt> @see </td></tr>
duke@1 77 * <tr><td><tt> @see </td> <td><tt> @link </td></tr>
duke@1 78 * <tr><td><tt> @see </td> <td><tt> @linkplain </td></tr>
duke@1 79 * <tr><td><tt> @serial </td> <td><tt> @serial </td></tr>
duke@1 80 * <tr><td><tt> @serial </td> <td><tt> @serialData </td></tr>
duke@1 81 * </table>
duke@1 82 */
duke@1 83 String kind();
duke@1 84
duke@1 85 /**
duke@1 86 * Return the text of this tag, that is, portion beyond tag name.
duke@1 87 */
duke@1 88 String text();
duke@1 89
duke@1 90 /**
duke@1 91 * Convert this object to a string.
duke@1 92 */
duke@1 93 String toString();
duke@1 94
duke@1 95 /**
duke@1 96 * For a documentation comment with embedded <code>{&#064;link}</code>
duke@1 97 * tags, return an array of <code>Tag</code> objects. The entire
duke@1 98 * doc comment is broken down into strings separated by
duke@1 99 * <code>{&#064;link}</code> tags, where each successive element
duke@1 100 * of the array represents either a string or
duke@1 101 * <code>{&#064;link}</code> tag, in order, from start to end.
duke@1 102 * Each string is represented by a <code>Tag</code> object of
duke@1 103 * name "Text", where {@link #text()} returns the string. Each
duke@1 104 * <code>{&#064;link}</code> tag is represented by a
duke@1 105 * {@link SeeTag} of name "@link" and kind "@see".
duke@1 106 * For example, given the following comment
duke@1 107 * tag:
duke@1 108 * <p>
duke@1 109 * <code>This is a {&#064;link Doc commentlabel} example.</code>
duke@1 110 * <p>
duke@1 111 * return an array of Tag objects:
duke@1 112 * <ul>
duke@1 113 * <li> tags[0] is a {@link Tag} with name "Text" and text consisting
duke@1 114 * of "This is a "
duke@1 115 * <li> tags[1] is a {@link SeeTag} with name "@link", referenced
duke@1 116 * class <code>Doc</code> and label "commentlabel"
duke@1 117 * <li> tags[2] is a {@link Tag} with name "Text" and text consisting
duke@1 118 * of " example."
duke@1 119 * </ul>
duke@1 120 *
duke@1 121 * @return Tag[] array of tags
duke@1 122 * @see ParamTag
duke@1 123 * @see ThrowsTag
duke@1 124 */
duke@1 125 Tag[] inlineTags();
duke@1 126
duke@1 127 /**
duke@1 128 * Return the first sentence of the comment as an array of tags.
duke@1 129 * Includes inline tags
duke@1 130 * (i.e. {&#64link <i>reference</i>} tags) but not
duke@1 131 * block tags.
duke@1 132 * Each section of plain text is represented as a {@link Tag}
duke@1 133 * of kind "Text".
duke@1 134 * Inline tags are represented as a {@link SeeTag} of kind "@link".
duke@1 135 * If the locale is English language, the first sentence is
duke@1 136 * determined by the rules described in the Java Language
duke@1 137 * Specification (first version): &quot;This sentence ends
duke@1 138 * at the first period that is followed by a blank, tab, or
duke@1 139 * line terminator or at the first tagline.&quot;, in
duke@1 140 * addition a line will be terminated by paragraph and
duke@1 141 * section terminating HTML tags: &lt;p&gt; &lt;/p&gt; &lt;h1&gt;
duke@1 142 * &lt;h2&gt; &lt;h3&gt; &lt;h4&gt; &lt;h5&gt; &lt;h6&gt;
duke@1 143 * &lt;hr&gt; &lt;pre&gt; or &lt;/pre&gt;.
duke@1 144 * If the locale is not English, the sentence end will be
duke@1 145 * determined by
duke@1 146 * {@link BreakIterator#getSentenceInstance(Locale)}.
duke@1 147 *
duke@1 148 * @return an array of {@link Tag} objects representing the
duke@1 149 * first sentence of the comment
duke@1 150 */
duke@1 151 Tag[] firstSentenceTags();
duke@1 152
duke@1 153 /**
duke@1 154 * Return the source position of this tag.
duke@1 155 * @return the source position of this tag.
duke@1 156 */
duke@1 157 public SourcePosition position();
duke@1 158 }

mercurial