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

Wed, 27 Apr 2016 01:34:52 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:34:52 +0800
changeset 0
959103a6100f
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/langtools/
changeset: 2573:53ca196be1ae
tag: jdk8u25-b17

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation. Oracle designates this
aoqi@0 8 * particular file as subject to the "Classpath" exception as provided
aoqi@0 9 * by Oracle in the LICENSE file that accompanied this code.
aoqi@0 10 *
aoqi@0 11 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 14 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 15 * accompanied this code).
aoqi@0 16 *
aoqi@0 17 * You should have received a copy of the GNU General Public License version
aoqi@0 18 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 20 *
aoqi@0 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 22 * or visit www.oracle.com if you need additional information or have any
aoqi@0 23 * questions.
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 package com.sun.javadoc;
aoqi@0 27
aoqi@0 28 import java.text.BreakIterator;
aoqi@0 29 import java.util.Locale;
aoqi@0 30
aoqi@0 31 /**
aoqi@0 32 * Represents a simple documentation tag, such as @since, @author, @version.
aoqi@0 33 * Given a tag (e.g. "@since 1.2"), holds tag name (e.g. "@since")
aoqi@0 34 * and tag text (e.g. "1.2"). Tags with structure or which require
aoqi@0 35 * special processing are handled by subclasses such as ParamTag
aoqi@0 36 * (for @param), SeeTag (for @see and {@link}), and ThrowsTag
aoqi@0 37 * (for @throws).
aoqi@0 38 *
aoqi@0 39 * @author Robert Field
aoqi@0 40 * @author Atul M Dambalkar
aoqi@0 41 * @see SeeTag
aoqi@0 42 * @see ParamTag
aoqi@0 43 * @see ThrowsTag
aoqi@0 44 * @see SerialFieldTag
aoqi@0 45 * @see Doc#tags()
aoqi@0 46 *
aoqi@0 47 */
aoqi@0 48 public interface Tag {
aoqi@0 49
aoqi@0 50 /**
aoqi@0 51 * Return the name of this tag. The name is the string
aoqi@0 52 * starting with "@" that is used in a doc comment, such as
aoqi@0 53 * <code>@return</code>. For inline tags, such as
aoqi@0 54 * <code>{&#064;link}</code>, the curly brackets
aoqi@0 55 * are not part of the name, so in this example the name
aoqi@0 56 * would be simply <code>@link</code>.
aoqi@0 57 *
aoqi@0 58 * @return the name of this tag
aoqi@0 59 */
aoqi@0 60 String name();
aoqi@0 61
aoqi@0 62 /**
aoqi@0 63 * Return the containing {@link Doc} of this Tag element.
aoqi@0 64 *
aoqi@0 65 * @return the containing {@link Doc} of this Tag element
aoqi@0 66 */
aoqi@0 67 Doc holder();
aoqi@0 68
aoqi@0 69 /**
aoqi@0 70 * Return the kind of this tag.
aoqi@0 71 * For most tags,
aoqi@0 72 * <code>kind()&nbsp;==&nbsp;name()</code>;
aoqi@0 73 * the following table lists those cases where there is more
aoqi@0 74 * than one tag of a given kind:
aoqi@0 75 *
aoqi@0 76 * <table border="1" cellpadding="4" cellspacing="0" summary="related tags">
aoqi@0 77 * <tr><th>{@code kind() }</th> <th>{@code name() }</th></tr>
aoqi@0 78 * <tr><td>{@code @throws }</td> <td>{@code @throws }</td></tr>
aoqi@0 79 * <tr><td>{@code @throws }</td> <td>{@code @exception }</td></tr>
aoqi@0 80 * <tr><td>{@code @see }</td> <td>{@code @see }</td></tr>
aoqi@0 81 * <tr><td>{@code @see }</td> <td>{@code @link }</td></tr>
aoqi@0 82 * <tr><td>{@code @see }</td> <td>{@code @linkplain }</td></tr>
aoqi@0 83 * <tr><td>{@code @serial }</td> <td>{@code @serial }</td></tr>
aoqi@0 84 * <tr><td>{@code @serial }</td> <td>{@code @serialData }</td></tr>
aoqi@0 85 * </table>
aoqi@0 86 *
aoqi@0 87 * @return the kind of this tag.
aoqi@0 88 */
aoqi@0 89 String kind();
aoqi@0 90
aoqi@0 91 /**
aoqi@0 92 * Return the text of this tag, that is, the portion beyond tag name.
aoqi@0 93 *
aoqi@0 94 * @return the text of this tag
aoqi@0 95 */
aoqi@0 96 String text();
aoqi@0 97
aoqi@0 98 /**
aoqi@0 99 * Convert this object to a string.
aoqi@0 100 */
aoqi@0 101 String toString();
aoqi@0 102
aoqi@0 103 /**
aoqi@0 104 * For a documentation comment with embedded <code>{&#064;link}</code>
aoqi@0 105 * tags, return an array of <code>Tag</code> objects. The entire
aoqi@0 106 * doc comment is broken down into strings separated by
aoqi@0 107 * <code>{&#064;link}</code> tags, where each successive element
aoqi@0 108 * of the array represents either a string or
aoqi@0 109 * <code>{&#064;link}</code> tag, in order, from start to end.
aoqi@0 110 * Each string is represented by a <code>Tag</code> object of
aoqi@0 111 * name "Text", where {@link #text()} returns the string. Each
aoqi@0 112 * <code>{&#064;link}</code> tag is represented by a
aoqi@0 113 * {@link SeeTag} of name "@link" and kind "@see".
aoqi@0 114 * For example, given the following comment
aoqi@0 115 * tag:
aoqi@0 116 * <p>
aoqi@0 117 * <code>This is a {&#064;link Doc commentlabel} example.</code>
aoqi@0 118 * <p>
aoqi@0 119 * return an array of Tag objects:
aoqi@0 120 * <ul>
aoqi@0 121 * <li> tags[0] is a {@link Tag} with name "Text" and text consisting
aoqi@0 122 * of "This is a "
aoqi@0 123 * <li> tags[1] is a {@link SeeTag} with name "@link", referenced
aoqi@0 124 * class <code>Doc</code> and label "commentlabel"
aoqi@0 125 * <li> tags[2] is a {@link Tag} with name "Text" and text consisting
aoqi@0 126 * of " example."
aoqi@0 127 * </ul>
aoqi@0 128 *
aoqi@0 129 * @return Tag[] array of tags
aoqi@0 130 * @see ParamTag
aoqi@0 131 * @see ThrowsTag
aoqi@0 132 */
aoqi@0 133 Tag[] inlineTags();
aoqi@0 134
aoqi@0 135 /**
aoqi@0 136 * Return the first sentence of the comment as an array of tags.
aoqi@0 137 * Includes inline tags
aoqi@0 138 * (i.e. {&#64;link <i>reference</i>} tags) but not
aoqi@0 139 * block tags.
aoqi@0 140 * Each section of plain text is represented as a {@link Tag}
aoqi@0 141 * of kind "Text".
aoqi@0 142 * Inline tags are represented as a {@link SeeTag} of kind "@link".
aoqi@0 143 * If the locale is English language, the first sentence is
aoqi@0 144 * determined by the rules described in the Java Language
aoqi@0 145 * Specification (first version): &quot;This sentence ends
aoqi@0 146 * at the first period that is followed by a blank, tab, or
aoqi@0 147 * line terminator or at the first tagline.&quot;, in
aoqi@0 148 * addition a line will be terminated by paragraph and
aoqi@0 149 * section terminating HTML tags: &lt;p&gt; &lt;/p&gt; &lt;h1&gt;
aoqi@0 150 * &lt;h2&gt; &lt;h3&gt; &lt;h4&gt; &lt;h5&gt; &lt;h6&gt;
aoqi@0 151 * &lt;hr&gt; &lt;pre&gt; or &lt;/pre&gt;.
aoqi@0 152 * If the locale is not English, the sentence end will be
aoqi@0 153 * determined by
aoqi@0 154 * {@link BreakIterator#getSentenceInstance(Locale)}.
aoqi@0 155 *
aoqi@0 156 * @return an array of {@link Tag} objects representing the
aoqi@0 157 * first sentence of the comment
aoqi@0 158 */
aoqi@0 159 Tag[] firstSentenceTags();
aoqi@0 160
aoqi@0 161 /**
aoqi@0 162 * Return the source position of this tag.
aoqi@0 163 * @return the source position of this tag.
aoqi@0 164 */
aoqi@0 165 public SourcePosition position();
aoqi@0 166 }

mercurial