com.sun.tools.doclets.internal.toolkit.util
Class ClassTree

java.lang.Object
  extended by com.sun.tools.doclets.internal.toolkit.util.ClassTree

public class ClassTree
extends java.lang.Object

Build Class Hierarchy for all the Classes. This class builds the Class Tree and the Interface Tree separately. This code is not part of an API. It is implementation that is subject to change. Do not use it as an API

See Also:
HashMap, List, Type, ClassDoc

Field Summary
private  java.util.List<ClassDoc> baseAnnotationTypes
           
private  java.util.List<ClassDoc> baseclasses
          List of baseclasses.
private  java.util.List<ClassDoc> baseEnums
           
private  java.util.List<ClassDoc> baseinterfaces
          List of base-interfaces.
private  java.util.Map<ClassDoc,java.util.List<ClassDoc>> implementingclasses
          Mapping for each Interface with classes who implement it.
private  java.util.Map<ClassDoc,java.util.List<ClassDoc>> subAnnotationTypes
           
private  java.util.Map<ClassDoc,java.util.List<ClassDoc>> subclasses
          Mapping for each Class with their SubClasses
private  java.util.Map<ClassDoc,java.util.List<ClassDoc>> subEnums
           
private  java.util.Map<ClassDoc,java.util.List<ClassDoc>> subinterfaces
          Mapping for each Interface with their SubInterfaces
 
Constructor Summary
ClassTree(ClassDoc[] classes, Configuration configuration)
          Constructor.
ClassTree(Configuration configuration, boolean noDeprecated)
          Constructor.
ClassTree(RootDoc root, Configuration configuration)
          Constructor.
 
Method Summary
private  boolean add(java.util.Map<ClassDoc,java.util.List<ClassDoc>> map, ClassDoc superclass, ClassDoc cd)
          Adjust the Class Tree.
 java.util.List<ClassDoc> allSubs(ClassDoc cd, boolean isEnum)
          Return a list of all direct or indirect, sub-classes and subinterfaces of the ClassDoc argument.
 java.util.List<ClassDoc> baseAnnotationTypes()
          Return the list of base annotation types.
 java.util.List<ClassDoc> baseclasses()
          Return the base-classes list.
 java.util.List<ClassDoc> baseEnums()
          Return the list of base enums.
 java.util.List<ClassDoc> baseinterfaces()
          Return the list of base interfaces.
private  void buildTree(ClassDoc[] classes, Configuration configuration)
          Generate mapping for the sub-classes for every class in this run.
private  java.util.List<ClassDoc> get(java.util.Map<ClassDoc,java.util.List<ClassDoc>> map, ClassDoc cd)
          From the map return the list of sub-classes or sub-interfaces.
 java.util.List<ClassDoc> implementingclasses(ClassDoc cd)
          Return the list of classes which implement the interface passed.
private  void processInterface(ClassDoc cd)
          For the interface passed get the interfaces which it extends, and then put this interface in the sub-interface list of those interfaces.
private  void processType(ClassDoc cd, Configuration configuration, java.util.List<ClassDoc> bases, java.util.Map<ClassDoc,java.util.List<ClassDoc>> subs)
          For the class passed map it to it's own sub-class listing.
 java.util.List<ClassDoc> subclasses(ClassDoc cd)
          Return the sub-class list for the class passed.
 java.util.List<ClassDoc> subinterfaces(ClassDoc cd)
          Return the sub-interface list for the interface passed.
 java.util.List<ClassDoc> subs(ClassDoc cd, boolean isEnum)
          Return the sub-class/interface list for the class/interface passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseclasses

private java.util.List<ClassDoc> baseclasses
List of baseclasses. Contains only java.lang.Object. Can be used to get the mapped listing of sub-classes.


subclasses

private java.util.Map<ClassDoc,java.util.List<ClassDoc>> subclasses
Mapping for each Class with their SubClasses


baseinterfaces

private java.util.List<ClassDoc> baseinterfaces
List of base-interfaces. Contains list of all the interfaces who do not have super-interfaces. Can be used to get the mapped listing of sub-interfaces.


subinterfaces

private java.util.Map<ClassDoc,java.util.List<ClassDoc>> subinterfaces
Mapping for each Interface with their SubInterfaces


baseEnums

private java.util.List<ClassDoc> baseEnums

subEnums

private java.util.Map<ClassDoc,java.util.List<ClassDoc>> subEnums

baseAnnotationTypes

private java.util.List<ClassDoc> baseAnnotationTypes

subAnnotationTypes

private java.util.Map<ClassDoc,java.util.List<ClassDoc>> subAnnotationTypes

implementingclasses

private java.util.Map<ClassDoc,java.util.List<ClassDoc>> implementingclasses
Mapping for each Interface with classes who implement it.

Constructor Detail

ClassTree

public ClassTree(Configuration configuration,
                 boolean noDeprecated)
Constructor. Build the Tree using the Root of this Javadoc run.

Parameters:
configuration - the configuration of the doclet.
noDeprecated - Don't add deprecated classes in the class tree, if true.

ClassTree

public ClassTree(RootDoc root,
                 Configuration configuration)
Constructor. Build the Tree using the Root of this Javadoc run.

Parameters:
root - Root of the Document.
configuration - The curren configuration of the doclet.

ClassTree

public ClassTree(ClassDoc[] classes,
                 Configuration configuration)
Constructor. Build the tree for the given array of classes.

Parameters:
classes - Array of classes.
configuration - The curren configuration of the doclet.
Method Detail

buildTree

private void buildTree(ClassDoc[] classes,
                       Configuration configuration)
Generate mapping for the sub-classes for every class in this run. Return the sub-class list for java.lang.Object which will be having sub-class listing for itself and also for each sub-class itself will have their own sub-class lists.

Parameters:
classes - all the classes in this run.
configuration - the current configuration of the doclet.

processType

private void processType(ClassDoc cd,
                         Configuration configuration,
                         java.util.List<ClassDoc> bases,
                         java.util.Map<ClassDoc,java.util.List<ClassDoc>> subs)
For the class passed map it to it's own sub-class listing. For the Class passed, get the super class, if superclass is non null, (it is not "java.lang.Object") get the "value" from the hashmap for this key Class if entry not found create one and get that. add this Class as a sub class in the list Recurse till hits java.lang.Object Null SuperClass.

Parameters:
cd - class for which sub-class mapping to be generated.
configuration - the current configurtation of the doclet.

processInterface

private void processInterface(ClassDoc cd)
For the interface passed get the interfaces which it extends, and then put this interface in the sub-interface list of those interfaces. Do it recursively. If a interface doesn't have super-interface just attach that interface in the list of all the baseinterfaces.

Parameters:
cd - Interface under consideration.

add

private boolean add(java.util.Map<ClassDoc,java.util.List<ClassDoc>> map,
                    ClassDoc superclass,
                    ClassDoc cd)
Adjust the Class Tree. Add the class interface in to it's super-class' or super-interface's sub-interface list.

Parameters:
map - the entire map.
superclass - java.lang.Object or the super-interface.
cd - sub-interface to be mapped.

get

private java.util.List<ClassDoc> get(java.util.Map<ClassDoc,java.util.List<ClassDoc>> map,
                                     ClassDoc cd)
From the map return the list of sub-classes or sub-interfaces. If list is null create a new one and return it.

Parameters:
map - The entire map.
cd - class for which the sub-class list is requested.

subclasses

public java.util.List<ClassDoc> subclasses(ClassDoc cd)
Return the sub-class list for the class passed.

Parameters:
cd - class whose sub-class list is required.

subinterfaces

public java.util.List<ClassDoc> subinterfaces(ClassDoc cd)
Return the sub-interface list for the interface passed.

Parameters:
cd - interface whose sub-interface list is required.

implementingclasses

public java.util.List<ClassDoc> implementingclasses(ClassDoc cd)
Return the list of classes which implement the interface passed.

Parameters:
cd - interface whose implementing-classes list is required.

subs

public java.util.List<ClassDoc> subs(ClassDoc cd,
                                     boolean isEnum)
Return the sub-class/interface list for the class/interface passed.

Parameters:
cd - class/interface whose sub-class/interface list is required.
isEnum - true if the subclasses should be forced to come from the enum tree.

allSubs

public java.util.List<ClassDoc> allSubs(ClassDoc cd,
                                        boolean isEnum)
Return a list of all direct or indirect, sub-classes and subinterfaces of the ClassDoc argument.

Parameters:
cd - ClassDoc whose sub-classes or sub-interfaces are requested.
isEnum - true if the subclasses should be forced to come from the enum tree.

baseclasses

public java.util.List<ClassDoc> baseclasses()
Return the base-classes list. This will have only one element namely thw classdoc for java.lang.Object, since this is the base class for all classes.


baseinterfaces

public java.util.List<ClassDoc> baseinterfaces()
Return the list of base interfaces. This is the list of interfaces which do not have super-interface.


baseEnums

public java.util.List<ClassDoc> baseEnums()
Return the list of base enums. This is the list of enums which do not have super-enums.


baseAnnotationTypes

public java.util.List<ClassDoc> baseAnnotationTypes()
Return the list of base annotation types. This is the list of annotation types which do not have super-annotation types.