Spec-Zone .ru
спецификации, руководства, описания, API
Doclet API

com.sun.javadoc
Interface Doc

All Superinterfaces:
Comparable
All Known Subinterfaces:
ClassDoc, ConstructorDoc, ExecutableMemberDoc, FieldDoc, MemberDoc, MethodDoc, PackageDoc, ProgramElementDoc, RootDoc

public interface Doc
extends Comparable

Represents Java language constructs (package, class, constructor, method, field) which have comments and have been processed by this run of javadoc. All Doc objects are unique, that is, they are == comparable.

Since:
JDK1.2

Method Summary
 String commentText()
          Return the text of the comment for this doc item.
 int compareTo(Object obj)
          Compares this doc object with the specified object for order.
 Tag[] firstSentenceTags()
          Return the first sentence of the comment as an array of tags.
 String getRawCommentText()
          Return the full unprocessed text of the comment.
 Tag[] inlineTags()
          Return comment as an array of tags.
 boolean isClass()
          Is this Doc item a class (not an interface)? This includes ordinary classes, errors and exceptions.
 boolean isConstructor()
          Is this Doc item a constructor?
 boolean isError()
          Is this Doc item an error class?
 boolean isException()
          Is this Doc item an exception class?
 boolean isField()
          Is this Doc item a field?
 boolean isIncluded()
          Return true if this Doc item is included in the result set.
 boolean isInterface()
          Is this Doc item an interface?
 boolean isMethod()
          Is this Doc item a method (i.e.
 boolean isOrdinaryClass()
          Is this Doc item an ordinary class? (i.e.
 String name()
          Returns the non-qualified name of this Doc item.
 SourcePosition position()
          Return the source position of the first line of the corresponding declaration, or null if no position is available.
 SeeTag[] seeTags()
          Return the see also tags in this Doc item.
 void setRawCommentText(String rawDocumentation)
          Set the full unprocessed text of the comment.
 Tag[] tags()
          Return all tags in this Doc item.
 Tag[] tags(String tagname)
          Return tags of the specified kind in this Doc item.
 

Method Detail

commentText

public String commentText()
Return the text of the comment for this doc item. Tags have been removed.


tags

public Tag[] tags()
Return all tags in this Doc item.

Returns:
an array of Tag objects containing all tags on this Doc item.

tags

public Tag[] tags(String tagname)
Return tags of the specified kind in this Doc item. For example, if 'tagname' has value "@serial", all tags in this Doc item of kind "@serial" will be returned.

Parameters:
tagname - name of the tag kind to search for.
Returns:
an array of Tag containing all tags whose 'kind()' matches 'tagname'.

seeTags

public SeeTag[] seeTags()
Return the see also tags in this Doc item.

Returns:
an array of SeeTag containing all @see tags.

inlineTags

public Tag[] inlineTags()
Return comment as an array of tags. Includes inline tags (i.e. {@link reference} tags) but not block tags. Each section of plain text is represented as a Tag of kind "Text". Inline tags are represented as a SeeTag of kind "@see" and name "@link".

Returns:
an array of Tags representing the comment

firstSentenceTags

public Tag[] firstSentenceTags()
Return the first sentence of the comment as an array of tags. Includes inline tags (i.e. {@link reference} tags) but not block tags. Each section of plain text is represented as a Tag of kind "Text". Inline tags are represented as a SeeTag of kind "@see" and name "@link".

If the locale is English language, the first sentence is determined by the rules described in the Java Language Specification (first version): "This sentence ends at the first period that is followed by a blank, tab, or line terminator or at the first tagline.", in addition a line will be terminated by block HTML tags: <p> </p> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <pre> or </pre>. If the locale is not English, the sentence end will be determined by java.text.BreakIterator.getSentenceInstance(Locale).

Returns:
an array of Tags representing the first sentence of the comment

getRawCommentText

public String getRawCommentText()
Return the full unprocessed text of the comment. Tags are included as text. Used mainly for store and retrieve operations like internalization.


setRawCommentText

public void setRawCommentText(String rawDocumentation)
Set the full unprocessed text of the comment. Tags are included as text. Used mainly for store and retrieve operations like internalization.


name

public String name()
Returns the non-qualified name of this Doc item.

Returns:
the name

compareTo

public int compareTo(Object obj)
Compares this doc object with the specified object for order. Returns a negative integer, zero, or a positive integer as this doc object is less than, equal to, or greater than the given object.

This method satisfies the Comparable interface.

Specified by:
compareTo in interface Comparable
Parameters:
obj - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this Object is less than, equal to, or greater than the given Object.
Throws:
ClassCastException - the specified Object's type prevents it from being compared to this Object.

isField

public boolean isField()
Is this Doc item a field?

Returns:
true if it represents a field

isMethod

public boolean isMethod()
Is this Doc item a method (i.e. not a constructor)? False until overridden.

Returns:
true if it represents a method, false if it is anything else, including constructor, field, class, ...

isConstructor

public boolean isConstructor()
Is this Doc item a constructor?

Returns:
true if it represents a constructor

isInterface

public boolean isInterface()
Is this Doc item an interface?

Returns:
true if it represents an interface

isException

public boolean isException()
Is this Doc item an exception class?

Returns:
true if it represents an exception

isError

public boolean isError()
Is this Doc item an error class?

Returns:
true if it represents a error

isOrdinaryClass

public boolean isOrdinaryClass()
Is this Doc item an ordinary class? (i.e. not an interface, exception, or error)?

Returns:
true if it represents an ordinary class

isClass

public boolean isClass()
Is this Doc item a class (not an interface)? This includes ordinary classes, errors and exceptions.

Returns:
true if it represents a class (not an interface)

isIncluded

public boolean isIncluded()
Return true if this Doc item is included in the result set.


position

public SourcePosition position()
Return the source position of the first line of the corresponding declaration, or null if no position is available. A default constructor returns null because it has no location in the source file.

Since:
1.4

Doclet API

Submit a bug or feature
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2003 Sun Microsystems, Inc. 4150 Network Circle
Santa Clara, California, 95054, U.S.A. All Rights Reserved.