src/share/classes/com/sun/javadoc/Doc.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 Java language constructs (package, class, constructor,
duke@1 33 * method, field) which have comments and have been processed by this
duke@1 34 * run of javadoc. All Doc objects are unique, that is, they
duke@1 35 * are == comparable.
duke@1 36 *
duke@1 37 * @since 1.2
duke@1 38 * @author Robert Field
duke@1 39 * @author Scott Seligman (generics, enums, annotations)
duke@1 40 */
duke@1 41 public interface Doc extends Comparable<Object> {
duke@1 42
duke@1 43 /**
duke@1 44 * Return the text of the comment for this doc item.
duke@1 45 * Tags have been removed.
duke@1 46 */
duke@1 47 String commentText();
duke@1 48
duke@1 49 /**
duke@1 50 * Return all tags in this Doc item.
duke@1 51 *
duke@1 52 * @return an array of {@link Tag} objects containing all tags on
duke@1 53 * this Doc item.
duke@1 54 */
duke@1 55 Tag[] tags();
duke@1 56
duke@1 57 /**
duke@1 58 * Return tags of the specified {@linkplain Tag#kind() kind} in
duke@1 59 * this Doc item.
duke@1 60 *
duke@1 61 * For example, if 'tagname' has value "@serial", all tags in
duke@1 62 * this Doc item of kind "@serial" will be returned.
duke@1 63 *
duke@1 64 * @param tagname name of the tag kind to search for.
duke@1 65 * @return an array of Tag containing all tags whose 'kind()'
duke@1 66 * matches 'tagname'.
duke@1 67 */
duke@1 68 Tag[] tags(String tagname);
duke@1 69
duke@1 70 /**
duke@1 71 * Return the see also tags in this Doc item.
duke@1 72 *
duke@1 73 * @return an array of SeeTag containing all @see tags.
duke@1 74 */
duke@1 75 SeeTag[] seeTags();
duke@1 76
duke@1 77 /**
duke@1 78 * Return comment as an array of tags. Includes inline tags
duke@1 79 * (i.e. {&#64link <i>reference</i>} tags) but not
duke@1 80 * block tags.
duke@1 81 * Each section of plain text is represented as a {@link Tag}
duke@1 82 * of {@linkplain Tag#kind() kind} "Text".
duke@1 83 * Inline tags are represented as a {@link SeeTag} of kind "@see"
duke@1 84 * and name "@link".
duke@1 85 *
duke@1 86 * @return an array of {@link Tag}s representing the comment
duke@1 87 */
duke@1 88 Tag[] inlineTags();
duke@1 89
duke@1 90 /**
duke@1 91 * Return the first sentence of the comment as an array of tags.
duke@1 92 * Includes inline tags
duke@1 93 * (i.e. {&#64link <i>reference</i>} tags) but not
duke@1 94 * block tags.
duke@1 95 * Each section of plain text is represented as a {@link Tag}
duke@1 96 * of {@linkplain Tag#kind() kind} "Text".
duke@1 97 * Inline tags are represented as a {@link SeeTag} of kind "@see"
duke@1 98 * and name "@link".
duke@1 99 * <p>
duke@1 100 * If the locale is English language, the first sentence is
duke@1 101 * determined by the rules described in the Java Language
duke@1 102 * Specification (first version): &quot;This sentence ends
duke@1 103 * at the first period that is followed by a blank, tab, or
duke@1 104 * line terminator or at the first tagline.&quot;, in
duke@1 105 * addition a line will be terminated by block
duke@1 106 * HTML tags: &lt;p&gt; &lt;/p&gt; &lt;h1&gt;
duke@1 107 * &lt;h2&gt; &lt;h3&gt; &lt;h4&gt; &lt;h5&gt; &lt;h6&gt;
duke@1 108 * &lt;hr&gt; &lt;pre&gt; or &lt;/pre&gt;.
duke@1 109 * If the locale is not English, the sentence end will be
duke@1 110 * determined by
duke@1 111 * {@link BreakIterator#getSentenceInstance(Locale)}.
duke@1 112
duke@1 113 * @return an array of {@link Tag}s representing the
duke@1 114 * first sentence of the comment
duke@1 115 */
duke@1 116 Tag[] firstSentenceTags();
duke@1 117
duke@1 118 /**
duke@1 119 * Return the full unprocessed text of the comment. Tags
duke@1 120 * are included as text. Used mainly for store and retrieve
duke@1 121 * operations like internalization.
duke@1 122 */
duke@1 123 String getRawCommentText();
duke@1 124
duke@1 125 /**
duke@1 126 * Set the full unprocessed text of the comment. Tags
duke@1 127 * are included as text. Used mainly for store and retrieve
duke@1 128 * operations like internalization.
duke@1 129 */
duke@1 130 void setRawCommentText(String rawDocumentation);
duke@1 131
duke@1 132 /**
duke@1 133 * Returns the non-qualified name of this Doc item.
duke@1 134 *
duke@1 135 * @return the name
duke@1 136 */
duke@1 137 String name();
duke@1 138
duke@1 139 /**
duke@1 140 * Compares this doc object with the specified object for order. Returns a
duke@1 141 * negative integer, zero, or a positive integer as this doc object is less
duke@1 142 * than, equal to, or greater than the given object.
duke@1 143 * <p>
duke@1 144 * This method satisfies the {@link java.lang.Comparable} interface.
duke@1 145 *
duke@1 146 * @param obj the <code>Object</code> to be compared.
duke@1 147 * @return a negative integer, zero, or a positive integer as this Object
duke@1 148 * is less than, equal to, or greater than the given Object.
duke@1 149 * @exception ClassCastException the specified Object's type prevents it
duke@1 150 * from being compared to this Object.
duke@1 151 */
duke@1 152 int compareTo(Object obj);
duke@1 153
duke@1 154 /**
duke@1 155 * Is this Doc item a field (but not an enum constant)?
duke@1 156 *
duke@1 157 * @return true if it represents a field
duke@1 158 */
duke@1 159 boolean isField();
duke@1 160
duke@1 161 /**
duke@1 162 * Is this Doc item an enum constant?
duke@1 163 *
duke@1 164 * @return true if it represents an enum constant
duke@1 165 * @since 1.5
duke@1 166 */
duke@1 167 boolean isEnumConstant();
duke@1 168
duke@1 169 /**
duke@1 170 * Is this Doc item a constructor?
duke@1 171 *
duke@1 172 * @return true if it represents a constructor
duke@1 173 */
duke@1 174 boolean isConstructor();
duke@1 175
duke@1 176 /**
duke@1 177 * Is this Doc item a method (but not a constructor or annotation
duke@1 178 * type element)?
duke@1 179 *
duke@1 180 * @return true if it represents a method
duke@1 181 */
duke@1 182 boolean isMethod();
duke@1 183
duke@1 184 /**
duke@1 185 * Is this Doc item an annotation type element?
duke@1 186 *
duke@1 187 * @return true if it represents an annotation type element
duke@1 188 * @since 1.5
duke@1 189 */
duke@1 190 boolean isAnnotationTypeElement();
duke@1 191
duke@1 192 /**
duke@1 193 * Is this Doc item an interface (but not an annotation type)?
duke@1 194 *
duke@1 195 * @return true if it represents an interface
duke@1 196 */
duke@1 197 boolean isInterface();
duke@1 198
duke@1 199 /**
duke@1 200 * Is this Doc item an exception class?
duke@1 201 *
duke@1 202 * @return true if it represents an exception
duke@1 203 */
duke@1 204 boolean isException();
duke@1 205
duke@1 206 /**
duke@1 207 * Is this Doc item an error class?
duke@1 208 *
duke@1 209 * @return true if it represents a error
duke@1 210 */
duke@1 211 boolean isError();
duke@1 212
duke@1 213 /**
duke@1 214 * Is this Doc item an enum type?
duke@1 215 *
duke@1 216 * @return true if it represents an enum type
duke@1 217 * @since 1.5
duke@1 218 */
duke@1 219 boolean isEnum();
duke@1 220
duke@1 221 /**
duke@1 222 * Is this Doc item an annotation type?
duke@1 223 *
duke@1 224 * @return true if it represents an annotation type
duke@1 225 * @since 1.5
duke@1 226 */
duke@1 227 boolean isAnnotationType();
duke@1 228
duke@1 229 /**
duke@1 230 * Is this Doc item an
duke@1 231 * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#class">ordinary
duke@1 232 * class</a>?
duke@1 233 * (i.e. not an interface, annotation type, enum, exception, or error)?
duke@1 234 *
duke@1 235 * @return true if it represents an ordinary class
duke@1 236 */
duke@1 237 boolean isOrdinaryClass();
duke@1 238
duke@1 239 /**
duke@1 240 * Is this Doc item a
duke@1 241 * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#class">class</a>
duke@1 242 * (and not an interface or annotation type)?
duke@1 243 * This includes ordinary classes, enums, errors and exceptions.
duke@1 244 *
duke@1 245 * @return true if it represents a class
duke@1 246 */
duke@1 247 boolean isClass();
duke@1 248
duke@1 249 /**
duke@1 250 * Return true if this Doc item is
duke@1 251 * <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a>
duke@1 252 * in the result set.
duke@1 253 */
duke@1 254 boolean isIncluded();
duke@1 255
duke@1 256 /**
duke@1 257 * Return the source position of the first line of the
duke@1 258 * corresponding declaration, or null if
duke@1 259 * no position is available. A default constructor returns
duke@1 260 * null because it has no location in the source file.
duke@1 261 *
duke@1 262 * @since 1.4
duke@1 263 */
duke@1 264 SourcePosition position();
duke@1 265 }

mercurial