Compiler tree API

The compiler tree API is in the com.sun.source.doctree package. It provides several interfaces to document source-level comments. These APIs are represented as abstract syntax trees (ASTs).

There are two enums as follows:

  • AttributeTree.ValueKind, with the following constants:
  • DOUBLE
  • EMPTY
  • SINGLE
  • UNQUOTED
  • DocTree.Kind, with the following constants:
  • ATTRIBUTE
  • AUTHOR
  • CODE
  • COMMENT
  • DEPRECATED
  • DOC_COMMENT
  • DOC_ROOT
  • END_ELEMENT
  • ENTITY
  • ERRONEOUS
  • EXCEPTION
  • IDENTIFIER
  • INHERIT_DOC
  • LINK
  • LINK_PLAIN
  • LITERAL
  • OTHER
  • PARAM
  • REFERENCE
  • RETURN
  • SEE
  • SERIAL
  • SERIAL_DATA
  • SERIAL_FIELD
  • SINCE
  • START_ELEMENT
  • TEXT
  • THROWS
  • UNKNOWN_BLOCK_TAG
  • UNKNOWN_INLINE_TAG
  • VALUE
  • VERSION

The com.sun.source.doctree package contains several interfaces. They are detailed in the following table:

Interface name Extends A tree node for Non-inherited methods
AttributeTree DocTree A HTML element getName(), getValue(), getValueKind()
AuthorTree BlockTagTree, DocTree @author block tag getName()
BlockTagTree DocTree The base class for different types of block tags getTagName()
CommentTree DocTree An embedded HTML comment with the following HTML tags—<!--text--> getBody()
DeprecatedTree BlockTagTree @deprecated block tag getBody()
DocCommentTree DocTree Body block tags getBlockTags(), getBody()getFirstSentence()
DocRootTree InlineTagTree @docroot inline tag N/A
DocTree N/A A common interface for all accept(DocTreeVisitor<R,D>visitor,Ddata)getKind()
DocTreeVisitor<R,P>  N/A  R = return type of visitor's methods; P = type of the additional parameter visitAttribute(AttributeTree node, P p)visitAuthor(AuthorTree node, P p)visitComment(CommentTree node, P p)visitDeprecated(DeprecatedTree node, P p)visitDocComment(DocCommentTree node, P p)visitDocRoot(DocRootTree node, P p)visitEndElement(EndElementTree node, P p)visitEntity(EntityTree node, P p)visitErroneous(ErroneousTree node, P p)visitIdentifier(IdentifierTree node, P p)visitInheritDoc(InheritDocTree node, P p)visitLink(LinkTree node, P p)visitLiteral(LiteralTree node, P p)visitOther(DocTree node, P p)visitParam(ParamTree node, P p)visitReference(ReferenceTree node, P p)visitReturn(ReturnTree node, P p)visitSee(SeeTree node, P p)visitSerial(SerialTree node, P p)visitSerialData(SerialDataTree node, P p)visitSerialField(SerialFieldTree node, P p), visitSince(SinceTree node, P p)visitStartElement(StartElementTree node, P p), visitText(TextTree node, P p)visitThrows(ThrowsTree node, P p)visitUnknownBlockTag(UnknownBlockTagTree node, P p)visitUnknownInlineTag(UnknownInlineTagTree node, P p), visitValue(ValueTree node, P p), visitVersion(VersionTree node, P p) 
EndElementTree DocTree End of an HTML element </name> getName()
EntityTree DocTree An HTML entity getName()
ErroneousTree TextTree This is for malformed text getDiagnostic()
IdentifierTree DocTree An identifier in a comment getName()
InheritDocTree InlineTagTree @inheritDoc inline tag N/A
InlineTagTree DocTree A common interface for inline tags getTagName()
LinkTree InlineTagTree @link or @linkplan inline tags getLabel(), getReference()
LiteralTree InlineTagTree @literal or @code inline tags getBody()
ParamTree BlockTagTree @param block tags getDescription(), getName()isTypeParameter()
ReferenceTree DocTree Used to reference a Java lang element getSignature()
ReturnTree BlockTagTree @return block tags getDescription()
SeeTree BlockTagTree @see block tags getReference()
SerialDataTree BlockTagTree @serialData block tags getDescription()
SerialFieldTree BlockTagTree @serialData block tags and @serialField field names and descriptions getDescription(), getName(), getType()
SerialTree BlockTagTree @serial block tags getDescription()
SinceTree BlockTagTree @since block tags getBody()
StartElementTree DocTree Start of an HTML element < name [attributes] [/] > getAttributes(), getName(), isSelfClosing()
TextTree DocTree Plain text getBody()
ThrowsTree BlockTagTree @exception or @throws block tags getDescription(), getExceptionname()
UnknownBlockTagTree BlockTagTree Unrecognized inline tags getContent()
UnknownInlineTagTree InlineTagTree Unrecognized inline tags getContent()
ValueTree InlineTagTree @value inline tags getReference()
VersionTree BlockTagTree @version block tags getBody()
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset