mjc

org.multijava.mjdoc.mjdoc_142
Class MjClassDoc

java.lang.Object
  extended byorg.multijava.mjdoc.mjdoc_142.MjDoc
      extended byorg.multijava.mjdoc.mjdoc_142.MjProgramElementDoc
          extended byorg.multijava.mjdoc.mjdoc_142.MjClassDoc
All Implemented Interfaces:
com.sun.javadoc.ClassDoc, Comparable, com.sun.javadoc.Doc, com.sun.javadoc.ProgramElementDoc, com.sun.javadoc.Type

public class MjClassDoc
extends MjProgramElementDoc
implements com.sun.javadoc.ClassDoc, com.sun.javadoc.Type

This class is an interface between the MJC syntax tree classes and the javadoc program; it wraps a CClass object.

Author:
David R. Cok

Nested Class Summary
static interface MjClassDoc.MemberFilter
           
static class MjClassDoc.MjMemberFilter
           
 
Field Summary
static boolean addDefaultConstructors
           
private  ArrayList allmethods
          Cached array of the methods (and external methods) of this class.
private  com.sun.javadoc.ClassDoc[] cachedImportedClasses
          A cached value (after being initialized) of the array of classes imported into the compilation unit this class is defined in.
private  com.sun.javadoc.PackageDoc[] cachedImportedPackages
          A cached value (after being initialized) of the array of packages imported into the compilation unit this class is defined in.
private  CClass cclass
          The CClass object that this class wraps.
private  String className
          Holds the identifier of the class.
private  boolean isDeprecated
          Cached value indicating whether there is an @deprecated tag.
private  boolean isError
          True if this object represents a class derived from java.lang.Error.
private  boolean isException
          True if this object represents a class derived from java.lang.Exception.
private  boolean isInterface
          True if this object represents an interface.
private  boolean isOrdinaryClass
          True if this object represents a class (not an interface, error or exception).
private  JTypeDeclarationType jtype
          Holds the MJ type that this wraps (when source code is available).
static MjClassDoc.MemberFilter memberFilter
           
private  ArrayList tlmethods
          ArrayList of the internal and external methods of this class.
 
Fields inherited from class org.multijava.mjdoc.mjdoc_142.MjProgramElementDoc
 
Fields inherited from class org.multijava.mjdoc.mjdoc_142.MjDoc
parser
 
Constructor Summary
MjClassDoc(CClass cc)
          Constructs an object from a CClass object (to be used when source code is not available).
MjClassDoc(JTypeDeclarationType jtype)
          A constructor for the case when source code is available (which makes javadoc comments and formal parameter identifiers available).
 
Method Summary
 MjMethodDoc addTLMethod(MJTopLevelMethodDeclaration tlm)
          Adds an external method to the set of such methods for this class, so appropriate information will be added to the generated html file.
 ArrayList allmethods()
          Returns the array of (internal and external) methods of this class (as a MjMethodDoc array), according to the filter set in memberFilter.
 com.sun.javadoc.ClassDoc asClassDoc()
          Returns the object, since it already is a ClassDoc.
 CClass cclass()
          Returns the CClass object that corresponds to this MjClassDoc.
 int compare(MjClassDoc mjd)
          Returns 0 if the classes are not comparable, 1 if the argument supercedes the object, -1 if the object supercedes the argument.
protected  String compareString()
          This generates the String representation used by compareTo.
 com.sun.javadoc.ConstructorDoc[] constructors()
          Returns the array of constructors of this class (as a MjConstructorDoc array); the result of this method depends on the current memberFilter.
 com.sun.javadoc.ConstructorDoc[] constructors(boolean filtered)
           
 ArrayList constructorsD(boolean addDefault)
           
 boolean definesSerializableFields()
          NOT IMPLEMENTED
 String dimension()
          Returns an empty string since a ClassDoc is not an array.
 com.sun.javadoc.FieldDoc[] fields()
           
 com.sun.javadoc.FieldDoc[] fields(boolean filtered)
          Returns the fields that are defined for the class represented by this.
 com.sun.javadoc.ClassDoc findClass(String className)
          NOT IMPLEMENTED - findClass
 MjMethodDoc findMethod(CMethod m)
          Looks for a method (with an MjMethodDoc) with matching name and signature to the argument that is registered in the MjClassDoc target object.
 MjMethodDoc findMethod(MjMethodDoc method)
          Looks for a method with matching name and signature to the argument in this class; if found the parent class method is returned; if not null is returned.
 MjMethodDoc findMethodRecursive(MjMethodDoc method)
          Looks for a method with matching name and signature to the argument in this class and in any superclasses, either until found (in which case the parent class method is returned) or not (null is returned).
 com.sun.javadoc.ClassDoc[] importedClasses()
          Returns the array of classes imported into the compilation unit this class is defined in.
 com.sun.javadoc.PackageDoc[] importedPackages()
          Returns the array of packages imported into the compilation unit this class is defined in.
private  void init(CClass cc)
          A helper method that completes the construction of an object.
 com.sun.javadoc.ClassDoc[] innerClasses()
          Returns an array of all the nested classes and nested interfaces of this class.
 com.sun.javadoc.ClassDoc[] innerClasses(boolean filtered)
           
 com.sun.javadoc.ClassDoc[] interfaces()
          Returns an array of all the interfaces implemented by this class.
 boolean isAbstract()
          Returns true if this class is abstract.
 boolean isClass()
          Returns true if this is a class (rather than an interface, field, method or constructor).
 boolean isError()
          Returns true if the object represents an interface type (rather than a class type).
 boolean isException()
          Returns true if the object represents an interface type (rather than a class type).
 boolean isExternalizable()
          UNKNOWN
 boolean isInterface()
          Returns true if the object represents an interface type (rather than a class type).
 boolean isOrdinaryClass()
          Returns true if the object represents a class type that is not an interface, an exception (derived from java.lang.Exception) or an error (derived from java.lang.Error).
 boolean isSerializable()
          UNKNOWN
 JTypeDeclarationType jtype()
          Returns the wrapped JTypeDeclarationType object.
 long longModifiers()
          Returns the modifiers of this class declaration encoded as bits in a long, using the MJ encoding.
private  void makeAllMethods()
          This method converts the methods of the CClass into MjMethodDoc objects.
 com.sun.javadoc.MethodDoc[] methods()
          Returns the array of (internal and external) methods of this class (as a MjMethodDoc array), according to the filter set in memberFilter.
 com.sun.javadoc.MethodDoc[] methods(boolean filtered)
           
 ArrayList methodsList()
          Returns the array of (internal and external) methods of this class (as a MjMethodDoc array), according to the filter set in memberFilter.
 String name()
          Returns the name of the class, with any enclosing classes prefixed, and with '.' as separator; no package name is prefixed.
 String qualifiedName()
          Returns the name of the class, with the package name and any enclosing classes prefixed, and with '.' as separator.
 String qualifiedTypeName()
          Returns the name of the class, with the package name and any enclosing classes prefixed, and with '.' as separator.
 com.sun.javadoc.FieldDoc[] serializableFields()
          UNKNOWN
 com.sun.javadoc.MethodDoc[] serializationMethods()
          UNKNOWN
 void setJtype(JTypeDeclarationType jt)
          A method to set the source code parse tree object for this class after it has been constructed.
 boolean subclassOf(com.sun.javadoc.ClassDoc c)
          Returns true if 'this' represents a class that is a subclass of the argument.
 boolean subclassOf(String qualifiedName)
          Returns true if 'this' represents a class that is a subclass of the argument.
 com.sun.javadoc.ClassDoc superclass()
          Returns (as a MjClassDoc object) the superclass of the class represented by the calling object.
 String toString()
          Returns the same thing as qualifiedTypeName().
 String typeName()
          Returns the name of the class, with any enclosing classes prefixed, and with '.' as separator; no package name is prefixed.
 
Methods inherited from class org.multijava.mjdoc.mjdoc_142.MjProgramElementDoc
containingClass, containingPackage, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, modifiers, modifierSpecifier
 
Methods inherited from class org.multijava.mjdoc.mjdoc_142.MjDoc
commentText, compareTo, firstSentenceTags, getRawCommentText, inlineTags, isConstructor, isField, isIncluded, isMethod, notImplemented, position, seeTags, setIncluded, setRawCommentText, setRawCommentText, setRawCommentText, setRawCommentText, tags, tags, tags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sun.javadoc.ProgramElementDoc
containingClass, containingPackage, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, modifiers, modifierSpecifier
 
Methods inherited from interface com.sun.javadoc.Doc
commentText, compareTo, firstSentenceTags, getRawCommentText, inlineTags, isConstructor, isField, isIncluded, isMethod, position, seeTags, setRawCommentText, tags, tags
 

Field Detail

className

private String className
Holds the identifier of the class.


jtype

private JTypeDeclarationType jtype
Holds the MJ type that this wraps (when source code is available).


cclass

private CClass cclass
The CClass object that this class wraps.


isInterface

private boolean isInterface
True if this object represents an interface.


isError

private boolean isError
True if this object represents a class derived from java.lang.Error.


isException

private boolean isException
True if this object represents a class derived from java.lang.Exception.


isOrdinaryClass

private boolean isOrdinaryClass
True if this object represents a class (not an interface, error or exception).


allmethods

private ArrayList allmethods
Cached array of the methods (and external methods) of this class.


tlmethods

private ArrayList tlmethods
ArrayList of the internal and external methods of this class. ArrayList of the external methods of this class.


isDeprecated

private boolean isDeprecated
Cached value indicating whether there is an @deprecated tag.


memberFilter

public static MjClassDoc.MemberFilter memberFilter

cachedImportedClasses

private com.sun.javadoc.ClassDoc[] cachedImportedClasses
A cached value (after being initialized) of the array of classes imported into the compilation unit this class is defined in.


cachedImportedPackages

private com.sun.javadoc.PackageDoc[] cachedImportedPackages
A cached value (after being initialized) of the array of packages imported into the compilation unit this class is defined in.


addDefaultConstructors

public static boolean addDefaultConstructors
Constructor Detail

MjClassDoc

public MjClassDoc(JTypeDeclarationType jtype)
A constructor for the case when source code is available (which makes javadoc comments and formal parameter identifiers available).


MjClassDoc

public MjClassDoc(CClass cc)
Constructs an object from a CClass object (to be used when source code is not available).

Method Detail

setJtype

public void setJtype(JTypeDeclarationType jt)
A method to set the source code parse tree object for this class after it has been constructed. Note that the type of the argument must match the type of the already built object.


init

private void init(CClass cc)
A helper method that completes the construction of an object.


isClass

public boolean isClass()
Returns true if this is a class (rather than an interface, field, method or constructor).

Specified by:
isClass in interface com.sun.javadoc.Doc
Overrides:
isClass in class MjDoc

isOrdinaryClass

public boolean isOrdinaryClass()
Returns true if the object represents a class type that is not an interface, an exception (derived from java.lang.Exception) or an error (derived from java.lang.Error).

Specified by:
isOrdinaryClass in interface com.sun.javadoc.Doc
Overrides:
isOrdinaryClass in class MjDoc

isInterface

public boolean isInterface()
Returns true if the object represents an interface type (rather than a class type).

Specified by:
isInterface in interface com.sun.javadoc.Doc
Overrides:
isInterface in class MjDoc

isError

public boolean isError()
Returns true if the object represents an interface type (rather than a class type).

Specified by:
isError in interface com.sun.javadoc.Doc
Overrides:
isError in class MjDoc

isException

public boolean isException()
Returns true if the object represents an interface type (rather than a class type).

Specified by:
isException in interface com.sun.javadoc.Doc
Overrides:
isException in class MjDoc

cclass

public CClass cclass()
Returns the CClass object that corresponds to this MjClassDoc.


name

public String name()
Returns the name of the class, with any enclosing classes prefixed, and with '.' as separator; no package name is prefixed.

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

jtype

public JTypeDeclarationType jtype()
Returns the wrapped JTypeDeclarationType object.


typeName

public String typeName()
Returns the name of the class, with any enclosing classes prefixed, and with '.' as separator; no package name is prefixed.

Specified by:
typeName in interface com.sun.javadoc.Type

qualifiedTypeName

public String qualifiedTypeName()
Returns the name of the class, with the package name and any enclosing classes prefixed, and with '.' as separator.

Specified by:
qualifiedTypeName in interface com.sun.javadoc.Type

qualifiedName

public String qualifiedName()
Returns the name of the class, with the package name and any enclosing classes prefixed, and with '.' as separator.

Specified by:
qualifiedName in interface com.sun.javadoc.ProgramElementDoc

toString

public String toString()
Returns the same thing as qualifiedTypeName().

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

asClassDoc

public com.sun.javadoc.ClassDoc asClassDoc()
Returns the object, since it already is a ClassDoc.

Specified by:
asClassDoc in interface com.sun.javadoc.Type

dimension

public String dimension()
Returns an empty string since a ClassDoc is not an array.

Specified by:
dimension in interface com.sun.javadoc.Type

definesSerializableFields

public boolean definesSerializableFields()
NOT IMPLEMENTED

Specified by:
definesSerializableFields in interface com.sun.javadoc.ClassDoc

fields

public com.sun.javadoc.FieldDoc[] fields(boolean filtered)
Returns the fields that are defined for the class represented by this.

Specified by:
fields in interface com.sun.javadoc.ClassDoc

fields

public com.sun.javadoc.FieldDoc[] fields()
Specified by:
fields in interface com.sun.javadoc.ClassDoc

findClass

public com.sun.javadoc.ClassDoc findClass(String className)
NOT IMPLEMENTED - findClass

Specified by:
findClass in interface com.sun.javadoc.ClassDoc

importedClasses

public com.sun.javadoc.ClassDoc[] importedClasses()
Returns the array of classes imported into the compilation unit this class is defined in.

Specified by:
importedClasses in interface com.sun.javadoc.ClassDoc

importedPackages

public com.sun.javadoc.PackageDoc[] importedPackages()
Returns the array of packages imported into the compilation unit this class is defined in.

Specified by:
importedPackages in interface com.sun.javadoc.ClassDoc

innerClasses

public com.sun.javadoc.ClassDoc[] innerClasses()
Returns an array of all the nested classes and nested interfaces of this class.

Specified by:
innerClasses in interface com.sun.javadoc.ClassDoc

innerClasses

public com.sun.javadoc.ClassDoc[] innerClasses(boolean filtered)
Specified by:
innerClasses in interface com.sun.javadoc.ClassDoc

interfaces

public com.sun.javadoc.ClassDoc[] interfaces()
Returns an array of all the interfaces implemented by this class.

Specified by:
interfaces in interface com.sun.javadoc.ClassDoc

methods

public com.sun.javadoc.MethodDoc[] methods()
Returns the array of (internal and external) methods of this class (as a MjMethodDoc array), according to the filter set in memberFilter.

Specified by:
methods in interface com.sun.javadoc.ClassDoc

methods

public com.sun.javadoc.MethodDoc[] methods(boolean filtered)
Specified by:
methods in interface com.sun.javadoc.ClassDoc

methodsList

public ArrayList methodsList()
Returns the array of (internal and external) methods of this class (as a MjMethodDoc array), according to the filter set in memberFilter.


allmethods

public ArrayList allmethods()
Returns the array of (internal and external) methods of this class (as a MjMethodDoc array), according to the filter set in memberFilter.


makeAllMethods

private void makeAllMethods()
This method converts the methods of the CClass into MjMethodDoc objects. This is done once and cached, because methods() is called often (whenever the class is a superclass or interface of a class.


constructors

public com.sun.javadoc.ConstructorDoc[] constructors()
Returns the array of constructors of this class (as a MjConstructorDoc array); the result of this method depends on the current memberFilter.

Specified by:
constructors in interface com.sun.javadoc.ClassDoc

constructors

public com.sun.javadoc.ConstructorDoc[] constructors(boolean filtered)
Specified by:
constructors in interface com.sun.javadoc.ClassDoc

constructorsD

public ArrayList constructorsD(boolean addDefault)

addTLMethod

public MjMethodDoc addTLMethod(MJTopLevelMethodDeclaration tlm)
Adds an external method to the set of such methods for this class, so appropriate information will be added to the generated html file.

Returns:
the MjMethodDoc object representing the external method

isAbstract

public boolean isAbstract()
Returns true if this class is abstract.

Specified by:
isAbstract in interface com.sun.javadoc.ClassDoc

isExternalizable

public boolean isExternalizable()
UNKNOWN

Specified by:
isExternalizable in interface com.sun.javadoc.ClassDoc

isSerializable

public boolean isSerializable()
UNKNOWN

Specified by:
isSerializable in interface com.sun.javadoc.ClassDoc

serializableFields

public com.sun.javadoc.FieldDoc[] serializableFields()
UNKNOWN

Specified by:
serializableFields in interface com.sun.javadoc.ClassDoc

serializationMethods

public com.sun.javadoc.MethodDoc[] serializationMethods()
UNKNOWN

Specified by:
serializationMethods in interface com.sun.javadoc.ClassDoc

subclassOf

public boolean subclassOf(com.sun.javadoc.ClassDoc c)
Returns true if 'this' represents a class that is a subclass of the argument.

Specified by:
subclassOf in interface com.sun.javadoc.ClassDoc

subclassOf

public boolean subclassOf(String qualifiedName)
Returns true if 'this' represents a class that is a subclass of the argument.

Parameters:
qualifiedName - A fully qualified, '.'-separated class name.

superclass

public com.sun.javadoc.ClassDoc superclass()
Returns (as a MjClassDoc object) the superclass of the class represented by the calling object.

Specified by:
superclass in interface com.sun.javadoc.ClassDoc

longModifiers

public long longModifiers()
Returns the modifiers of this class declaration encoded as bits in a long, using the MJ encoding.


findMethodRecursive

public MjMethodDoc findMethodRecursive(MjMethodDoc method)
Looks for a method with matching name and signature to the argument in this class and in any superclasses, either until found (in which case the parent class method is returned) or not (null is returned).


findMethod

public MjMethodDoc findMethod(MjMethodDoc method)
Looks for a method with matching name and signature to the argument in this class; if found the parent class method is returned; if not null is returned.


findMethod

public MjMethodDoc findMethod(CMethod m)
Looks for a method (with an MjMethodDoc) with matching name and signature to the argument that is registered in the MjClassDoc target object. If found the appropriate MjMethodDoc object is returned; if not found, null is returned.


compareString

protected String compareString()
This generates the String representation used by compareTo. We use a different method than toString, because toString is not unique in all cases (e.g. methods with the same identifier but different arguments). This is used for the index.

Overrides:
compareString in class MjDoc

compare

public int compare(MjClassDoc mjd)
Returns 0 if the classes are not comparable, 1 if the argument supercedes the object, -1 if the object supercedes the argument.


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.