src/jdk.javadoc/share/classes/com/sun/javadoc/Doc.java
changeset 53885 e03bbe023e50
parent 53884 1a7b57d02107
child 53886 e94ed0236046
child 57204 7aa6f61ad1c0
equal deleted inserted replaced
53884:1a7b57d02107 53885:e03bbe023e50
     1 /*
       
     2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 package com.sun.javadoc;
       
    27 
       
    28 import java.text.BreakIterator;
       
    29 import java.util.Locale;
       
    30 
       
    31 /**
       
    32  * Represents Java language constructs (package, class, constructor,
       
    33  * method, field) which have comments and have been processed by this
       
    34  * run of javadoc.  All Doc objects are unique, that is, they
       
    35  * are == comparable.
       
    36  *
       
    37  * @since 1.2
       
    38  * @author Robert Field
       
    39  * @author Scott Seligman (generics, enums, annotations)
       
    40  *
       
    41  * @deprecated
       
    42  *   The declarations in this package have been superseded by those
       
    43  *   in the package {@code jdk.javadoc.doclet}.
       
    44  *   For more information, see the <i>Migration Guide</i> in the documentation for that package.
       
    45  */
       
    46 @Deprecated(since="9", forRemoval=true)
       
    47 @SuppressWarnings("removal")
       
    48 public interface Doc extends Comparable<Object> {
       
    49 
       
    50     /**
       
    51      * Return the text of the comment for this doc item.
       
    52      * Tags have been removed.
       
    53      *
       
    54      * @return the text of the comment for this doc item.
       
    55      */
       
    56     String commentText();
       
    57 
       
    58     /**
       
    59      * Return all tags in this Doc item.
       
    60      *
       
    61      * @return an array of {@link Tag} objects containing all tags on
       
    62      *         this Doc item.
       
    63      */
       
    64     Tag[] tags();
       
    65 
       
    66     /**
       
    67      * Return tags of the specified {@linkplain Tag#kind() kind} in
       
    68      * this Doc item.
       
    69      *
       
    70      * For example, if 'tagname' has value "@serial", all tags in
       
    71      * this Doc item of kind "@serial" will be returned.
       
    72      *
       
    73      * @param tagname name of the tag kind to search for.
       
    74      * @return an array of Tag containing all tags whose 'kind()'
       
    75      * matches 'tagname'.
       
    76      */
       
    77     Tag[] tags(String tagname);
       
    78 
       
    79     /**
       
    80      * Return the see also tags in this Doc item.
       
    81      *
       
    82      * @return an array of SeeTag containing all @see tags.
       
    83      */
       
    84     SeeTag[] seeTags();
       
    85 
       
    86     /**
       
    87      * Return comment as an array of tags. Includes inline tags
       
    88      * (i.e. {&#64;link <i>reference</i>} tags)  but not
       
    89      * block tags.
       
    90      * Each section of plain text is represented as a {@link Tag}
       
    91      * of {@linkplain Tag#kind() kind} "Text".
       
    92      * Inline tags are represented as a {@link SeeTag} of kind "@see"
       
    93      * and name "@link".
       
    94      *
       
    95      * @return an array of {@link Tag}s representing the comment
       
    96      */
       
    97     Tag[] inlineTags();
       
    98 
       
    99     /**
       
   100      * Return the first sentence of the comment as an array of tags.
       
   101      * Includes inline tags
       
   102      * (i.e. {&#64;link <i>reference</i>} tags)  but not
       
   103      * block tags.
       
   104      * Each section of plain text is represented as a {@link Tag}
       
   105      * of {@linkplain Tag#kind() kind} "Text".
       
   106      * Inline tags are represented as a {@link SeeTag} of kind "@see"
       
   107      * and name "@link".
       
   108      * <p>
       
   109      * If the locale is English language, the first sentence is
       
   110      * determined by the rules described in the Java Language
       
   111      * Specification (first version): &quot;This sentence ends
       
   112      * at the first period that is followed by a blank, tab, or
       
   113      * line terminator or at the first tagline.&quot;, in
       
   114      * addition a line will be terminated by block
       
   115      * HTML tags: &lt;p&gt;  &lt;/p&gt;  &lt;h1&gt;
       
   116      * &lt;h2&gt;  &lt;h3&gt; &lt;h4&gt;  &lt;h5&gt;  &lt;h6&gt;
       
   117      * &lt;hr&gt;  &lt;pre&gt;  or &lt;/pre&gt;.
       
   118      * If the locale is not English, the sentence end will be
       
   119      * determined by
       
   120      * {@link BreakIterator#getSentenceInstance(Locale)}.
       
   121 
       
   122      * @return an array of {@link Tag}s representing the
       
   123      * first sentence of the comment
       
   124      */
       
   125     Tag[] firstSentenceTags();
       
   126 
       
   127     /**
       
   128      * Return the full unprocessed text of the comment.  Tags
       
   129      * are included as text.  Used mainly for store and retrieve
       
   130      * operations like internalization.
       
   131      *
       
   132      * @return the full unprocessed text of the comment.
       
   133      */
       
   134     String getRawCommentText();
       
   135 
       
   136     /**
       
   137      * Set the full unprocessed text of the comment.  Tags
       
   138      * are included as text.  Used mainly for store and retrieve
       
   139      * operations like internalization.
       
   140      *
       
   141      * @param rawDocumentation A String containing the full unprocessed text of the comment.
       
   142      */
       
   143     void setRawCommentText(String rawDocumentation);
       
   144 
       
   145     /**
       
   146      * Returns the non-qualified name of this Doc item.
       
   147      *
       
   148      * @return  the name
       
   149      */
       
   150     String name();
       
   151 
       
   152     /**
       
   153      * Compares this doc object with the specified object for order.  Returns a
       
   154      * negative integer, zero, or a positive integer as this doc object is less
       
   155      * than, equal to, or greater than the given object.
       
   156      * <p>
       
   157      * This method satisfies the {@link java.lang.Comparable} interface.
       
   158      *
       
   159      * @param   obj  the {@code Object} to be compared.
       
   160      * @return  a negative integer, zero, or a positive integer as this Object
       
   161      *      is less than, equal to, or greater than the given Object.
       
   162      * @exception ClassCastException the specified Object's type prevents it
       
   163      *        from being compared to this Object.
       
   164      */
       
   165     int compareTo(Object obj);
       
   166 
       
   167     /**
       
   168      * Is this Doc item a field (but not an enum constant)?
       
   169      *
       
   170      * @return true if it represents a field
       
   171      */
       
   172     boolean isField();
       
   173 
       
   174     /**
       
   175      * Is this Doc item an enum constant?
       
   176      *
       
   177      * @return true if it represents an enum constant
       
   178      * @since 1.5
       
   179      */
       
   180     boolean isEnumConstant();
       
   181 
       
   182     /**
       
   183      * Is this Doc item a constructor?
       
   184      *
       
   185      * @return true if it represents a constructor
       
   186      */
       
   187     boolean isConstructor();
       
   188 
       
   189     /**
       
   190      * Is this Doc item a method (but not a constructor or annotation
       
   191      * type element)?
       
   192      *
       
   193      * @return true if it represents a method
       
   194      */
       
   195     boolean isMethod();
       
   196 
       
   197     /**
       
   198      * Is this Doc item an annotation type element?
       
   199      *
       
   200      * @return true if it represents an annotation type element
       
   201      * @since 1.5
       
   202      */
       
   203     boolean isAnnotationTypeElement();
       
   204 
       
   205     /**
       
   206      * Is this Doc item an interface (but not an annotation type)?
       
   207      *
       
   208      * @return true if it represents an interface
       
   209      */
       
   210     boolean isInterface();
       
   211 
       
   212     /**
       
   213      * Is this Doc item an exception class?
       
   214      *
       
   215      * @return true if it represents an exception
       
   216      */
       
   217     boolean isException();
       
   218 
       
   219     /**
       
   220      * Is this Doc item an error class?
       
   221      *
       
   222      * @return true if it represents a error
       
   223      */
       
   224     boolean isError();
       
   225 
       
   226     /**
       
   227      * Is this Doc item an enum type?
       
   228      *
       
   229      * @return true if it represents an enum type
       
   230      * @since 1.5
       
   231      */
       
   232     boolean isEnum();
       
   233 
       
   234     /**
       
   235      * Is this Doc item an annotation type?
       
   236      *
       
   237      * @return true if it represents an annotation type
       
   238      * @since 1.5
       
   239      */
       
   240     boolean isAnnotationType();
       
   241 
       
   242     /**
       
   243      * Is this Doc item an
       
   244      * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#class">ordinary
       
   245      * class</a>?
       
   246      * (i.e. not an interface, annotation type, enum, exception, or error)?
       
   247      *
       
   248      * @return true if it represents an ordinary class
       
   249      */
       
   250     boolean isOrdinaryClass();
       
   251 
       
   252     /**
       
   253      * Is this Doc item a
       
   254      * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#class">class</a>
       
   255      * (and not an interface or annotation type)?
       
   256      * This includes ordinary classes, enums, errors and exceptions.
       
   257      *
       
   258      * @return true if it represents a class
       
   259      */
       
   260     boolean isClass();
       
   261 
       
   262     /**
       
   263      * Return true if this Doc item is
       
   264      * <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
       
   265      * in the result set.
       
   266      *
       
   267      * @return true if this Doc item is
       
   268      *         <a href="{@docRoot}/jdk.javadoc/com/sun/javadoc/package-summary.html#included">included</a>
       
   269      *         in the result set.
       
   270      */
       
   271     boolean isIncluded();
       
   272 
       
   273     /**
       
   274      * Return the source position of the first line of the
       
   275      * corresponding declaration, or null if
       
   276      * no position is available.  A default constructor returns
       
   277      * null because it has no location in the source file.
       
   278      *
       
   279      * @since 1.4
       
   280      * @return the source positino of the first line of the
       
   281      *         corresponding declaration, or null if
       
   282      *         no position is available.  A default constructor returns
       
   283      *         null because it has no location in the source file.
       
   284      */
       
   285     SourcePosition position();
       
   286 }