Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/com/sun/javadoc/Doc.java
38890 views
/*1* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.javadoc;2627import java.text.BreakIterator;28import java.util.Locale;2930/**31* Represents Java language constructs (package, class, constructor,32* method, field) which have comments and have been processed by this33* run of javadoc. All Doc objects are unique, that is, they34* are == comparable.35*36* @since 1.237* @author Robert Field38* @author Scott Seligman (generics, enums, annotations)39*/40public interface Doc extends Comparable<Object> {4142/**43* Return the text of the comment for this doc item.44* Tags have been removed.45*/46String commentText();4748/**49* Return all tags in this Doc item.50*51* @return an array of {@link Tag} objects containing all tags on52* this Doc item.53*/54Tag[] tags();5556/**57* Return tags of the specified {@linkplain Tag#kind() kind} in58* this Doc item.59*60* For example, if 'tagname' has value "@serial", all tags in61* this Doc item of kind "@serial" will be returned.62*63* @param tagname name of the tag kind to search for.64* @return an array of Tag containing all tags whose 'kind()'65* matches 'tagname'.66*/67Tag[] tags(String tagname);6869/**70* Return the see also tags in this Doc item.71*72* @return an array of SeeTag containing all @see tags.73*/74SeeTag[] seeTags();7576/**77* Return comment as an array of tags. Includes inline tags78* (i.e. {@link <i>reference</i>} tags) but not79* block tags.80* Each section of plain text is represented as a {@link Tag}81* of {@linkplain Tag#kind() kind} "Text".82* Inline tags are represented as a {@link SeeTag} of kind "@see"83* and name "@link".84*85* @return an array of {@link Tag}s representing the comment86*/87Tag[] inlineTags();8889/**90* Return the first sentence of the comment as an array of tags.91* Includes inline tags92* (i.e. {@link <i>reference</i>} tags) but not93* block tags.94* Each section of plain text is represented as a {@link Tag}95* of {@linkplain Tag#kind() kind} "Text".96* Inline tags are represented as a {@link SeeTag} of kind "@see"97* and name "@link".98* <p>99* If the locale is English language, the first sentence is100* determined by the rules described in the Java Language101* Specification (first version): "This sentence ends102* at the first period that is followed by a blank, tab, or103* line terminator or at the first tagline.", in104* addition a line will be terminated by block105* HTML tags: <p> </p> <h1>106* <h2> <h3> <h4> <h5> <h6>107* <hr> <pre> or </pre>.108* If the locale is not English, the sentence end will be109* determined by110* {@link BreakIterator#getSentenceInstance(Locale)}.111112* @return an array of {@link Tag}s representing the113* first sentence of the comment114*/115Tag[] firstSentenceTags();116117/**118* Return the full unprocessed text of the comment. Tags119* are included as text. Used mainly for store and retrieve120* operations like internalization.121*/122String getRawCommentText();123124/**125* Set the full unprocessed text of the comment. Tags126* are included as text. Used mainly for store and retrieve127* operations like internalization.128*/129void setRawCommentText(String rawDocumentation);130131/**132* Returns the non-qualified name of this Doc item.133*134* @return the name135*/136String name();137138/**139* Compares this doc object with the specified object for order. Returns a140* negative integer, zero, or a positive integer as this doc object is less141* than, equal to, or greater than the given object.142* <p>143* This method satisfies the {@link java.lang.Comparable} interface.144*145* @param obj the <code>Object</code> to be compared.146* @return a negative integer, zero, or a positive integer as this Object147* is less than, equal to, or greater than the given Object.148* @exception ClassCastException the specified Object's type prevents it149* from being compared to this Object.150*/151int compareTo(Object obj);152153/**154* Is this Doc item a field (but not an enum constant)?155*156* @return true if it represents a field157*/158boolean isField();159160/**161* Is this Doc item an enum constant?162*163* @return true if it represents an enum constant164* @since 1.5165*/166boolean isEnumConstant();167168/**169* Is this Doc item a constructor?170*171* @return true if it represents a constructor172*/173boolean isConstructor();174175/**176* Is this Doc item a method (but not a constructor or annotation177* type element)?178*179* @return true if it represents a method180*/181boolean isMethod();182183/**184* Is this Doc item an annotation type element?185*186* @return true if it represents an annotation type element187* @since 1.5188*/189boolean isAnnotationTypeElement();190191/**192* Is this Doc item an interface (but not an annotation type)?193*194* @return true if it represents an interface195*/196boolean isInterface();197198/**199* Is this Doc item an exception class?200*201* @return true if it represents an exception202*/203boolean isException();204205/**206* Is this Doc item an error class?207*208* @return true if it represents a error209*/210boolean isError();211212/**213* Is this Doc item an enum type?214*215* @return true if it represents an enum type216* @since 1.5217*/218boolean isEnum();219220/**221* Is this Doc item an annotation type?222*223* @return true if it represents an annotation type224* @since 1.5225*/226boolean isAnnotationType();227228/**229* Is this Doc item an230* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#class">ordinary231* class</a>?232* (i.e. not an interface, annotation type, enum, exception, or error)?233*234* @return true if it represents an ordinary class235*/236boolean isOrdinaryClass();237238/**239* Is this Doc item a240* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#class">class</a>241* (and not an interface or annotation type)?242* This includes ordinary classes, enums, errors and exceptions.243*244* @return true if it represents a class245*/246boolean isClass();247248/**249* Return true if this Doc item is250* <a href="{@docRoot}/com/sun/javadoc/package-summary.html#included">included</a>251* in the result set.252*/253boolean isIncluded();254255/**256* Return the source position of the first line of the257* corresponding declaration, or null if258* no position is available. A default constructor returns259* null because it has no location in the source file.260*261* @since 1.4262*/263SourcePosition position();264}265266267