mjc

org.multijava.mjdoc.mjdoc_142
Class MjTag

java.lang.Object
  extended byorg.multijava.mjdoc.mjdoc_142.MjTag
All Implemented Interfaces:
com.sun.javadoc.Tag
Direct Known Subclasses:
MjGenericTag, MjParamTag, MjSeeTag, MjTextTag, MjThrowsTag

public abstract class MjTag
extends Object
implements com.sun.javadoc.Tag

This class is the abstract parent task for the various special kinds of tag objects that represent tags in javadoc comments. Generically speaking, a tag consists of a kind, a name, and a set of inline tags which, when rendered sequentially, constitute the description of the tag. Some tags in addition have other fields that are parsed from the javadoc comment, such as the name of a formal parameter or class of a thrown exception.

Author:
David R. Cok

Field Summary
protected  com.sun.javadoc.Tag[] fstags
          This holds the value for firstSentenceTags.
private  String name
          The name of the tag.
protected  MjDoc owner
          The Doc object to which this tag belongs.
protected  com.sun.javadoc.SourcePosition position
          The SourcePosition giving the location of this tag; currently the source position of the javadoc comment.
protected  com.sun.javadoc.Tag[] tags
          The sequence of inline tags that constitute the description of the tag.
private  String text
          The raw, unparsed text of the tag.
 
Constructor Summary
MjTag(com.sun.javadoc.Doc owner, String n, String t)
          A constructor for this parent class, which sets the name and unparsed text.
MjTag(com.sun.javadoc.Doc owner, String n, String t, com.sun.javadoc.SourcePosition pos)
           
 
Method Summary
 MjClassDoc containingClass()
          Returns the class that this tag modifies or is in (note that 'owner' is the program element the tag modifies.
(package private) static MjTag create(com.sun.javadoc.Doc owner, String rawText, com.sun.javadoc.SourcePosition pos)
          This static method parses the text from a javadoc comment tag to create the correct derived class instance of tag; the argument must begin with whitespace and an '@' symbol representing the start of the tag.
 com.sun.javadoc.Tag[] firstSentenceTags()
          This returns the value that javadoc returns for the dervied classes.
 com.sun.javadoc.Doc holder()
          Accessor method to return the owner of the tag.
 com.sun.javadoc.Tag[] inlineTags()
          Returns the descriptionm (the text) of the tag as a sequence of tags (typically text and inline tags such as link tags).
 com.sun.javadoc.Tag[] inlineTags(String description, com.sun.javadoc.SourcePosition pos)
          This helper method is used by some derived classes to convert raw, unparsed javadoc comment text into a sequence of tags (text and inline tags such as link tags), as must be assigned to the 'tags' protected variable and is returned by the inlineTags() method.
abstract  String kind()
          This method must be overridden by derived classes to return the 'kind' of the tag.
 String name()
          Accessor method to return the name of the tag.
 com.sun.javadoc.SourcePosition position()
           
 MjClassDoc resolveReference(String name)
          This is used by tags to resolve references to classes as they are given in tags (such as @see, @link, @throws, @exception tags).
 String text()
          Accessor method to return the unparsed text of tag.
 String toString()
          Makes a String representation of the tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

text

private String text
The raw, unparsed text of the tag.


name

private String name
The name of the tag.


tags

protected com.sun.javadoc.Tag[] tags
The sequence of inline tags that constitute the description of the tag. Derived class constructors must set this field directly.


fstags

protected com.sun.javadoc.Tag[] fstags
This holds the value for firstSentenceTags. Derived class constructors must set this field directly.


owner

protected MjDoc owner
The Doc object to which this tag belongs.


position

protected com.sun.javadoc.SourcePosition position
The SourcePosition giving the location of this tag; currently the source position of the javadoc comment.

Constructor Detail

MjTag

public MjTag(com.sun.javadoc.Doc owner,
             String n,
             String t)
A constructor for this parent class, which sets the name and unparsed text. Derived class constructors are required in addition to compute and set the value of 'tags'.

Parameters:
n - the name of the javadoc comment tag
t - the unparsed text of the javadoc comment tag

MjTag

public MjTag(com.sun.javadoc.Doc owner,
             String n,
             String t,
             com.sun.javadoc.SourcePosition pos)
Method Detail

containingClass

public MjClassDoc containingClass()
Returns the class that this tag modifies or is in (note that 'owner' is the program element the tag modifies.


firstSentenceTags

public com.sun.javadoc.Tag[] firstSentenceTags()
This returns the value that javadoc returns for the dervied classes. The value does not appear to have any meaning or specification, and the result does not appear to be useful, but for easy of comparison testing, we copy javadoc.

Specified by:
firstSentenceTags in interface com.sun.javadoc.Tag

inlineTags

public com.sun.javadoc.Tag[] inlineTags()
Returns the descriptionm (the text) of the tag as a sequence of tags (typically text and inline tags such as link tags). This requires that the protected 'tags' field have been set by derived class constructors.

Specified by:
inlineTags in interface com.sun.javadoc.Tag

kind

public abstract String kind()
This method must be overridden by derived classes to return the 'kind' of the tag.

Specified by:
kind in interface com.sun.javadoc.Tag

holder

public com.sun.javadoc.Doc holder()
Accessor method to return the owner of the tag.

Specified by:
holder in interface com.sun.javadoc.Tag

name

public String name()
Accessor method to return the name of the tag.

Specified by:
name in interface com.sun.javadoc.Tag

text

public String text()
Accessor method to return the unparsed text of tag.

Specified by:
text in interface com.sun.javadoc.Tag

toString

public String toString()
Makes a String representation of the tag.

Specified by:
toString in interface com.sun.javadoc.Tag
Overrides:
toString in class Object

create

static MjTag create(com.sun.javadoc.Doc owner,
                    String rawText,
                    com.sun.javadoc.SourcePosition pos)
This static method parses the text from a javadoc comment tag to create the correct derived class instance of tag; the argument must begin with whitespace and an '@' symbol representing the start of the tag.


inlineTags

public com.sun.javadoc.Tag[] inlineTags(String description,
                                        com.sun.javadoc.SourcePosition pos)
This helper method is used by some derived classes to convert raw, unparsed javadoc comment text into a sequence of tags (text and inline tags such as link tags), as must be assigned to the 'tags' protected variable and is returned by the inlineTags() method.


resolveReference

public MjClassDoc resolveReference(String name)
This is used by tags to resolve references to classes as they are given in tags (such as @see, @link, @throws, @exception tags). Javadoc only recognizes classes that have already been referenced. Mention in a tag does not cause the class to be parsed or loaded.

Parameters:
name - identifier or '.'-separated name of a class

position

public com.sun.javadoc.SourcePosition position()
Specified by:
position in interface com.sun.javadoc.Tag

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.