org.sape.carbon.core.util.reflection
Class ClassTree.ClassTreeNode

java.lang.Object
  |
  +--org.sape.carbon.core.util.reflection.ClassTree.ClassTreeNode
All Implemented Interfaces:
Comparable
Enclosing class:
ClassTree

public static class ClassTree.ClassTreeNode
extends Object
implements Comparable

Inner class representing each node in the tree. Holds references to the nodes children, parent and provides the Comparable interface for sorting by inheritance hierarchy.


Field Summary
protected  List children
          The map of children classes to their class names
protected  Class objectClass
          The class of this node
protected  List parents
          A reference to the parent node of this node
 
Constructor Summary
ClassTree.ClassTreeNode(Class objectClass)
          Constructs a ClassTreeNode with the given Class.
 
Method Summary
 void addChild(ClassTree.ClassTreeNode node)
           
 void addParent(ClassTree.ClassTreeNode node)
           
static ClassTree.ClassTreeNode buildNode(Class objectClass)
           
protected static ClassTree.ClassTreeNode buildNode(Class objectClass, Map allNodes)
           
 int compareTo(Object obj)
          Compares one class to another class by their inheritance tree.
 boolean equals(Object obj)
           
 List getChildren()
           
 String getClassName()
           
 Class getObjectClass()
           
 List getParents()
           
 int hashCode()
           
 boolean removeChild(ClassTree.ClassTreeNode node)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectClass

protected Class objectClass
The class of this node


children

protected List children
The map of children classes to their class names


parents

protected List parents
A reference to the parent node of this node

Constructor Detail

ClassTree.ClassTreeNode

public ClassTree.ClassTreeNode(Class objectClass)

Constructs a ClassTreeNode with the given Class.

Parameters:
objectClass - the Class of the node
Method Detail

buildNode

public static ClassTree.ClassTreeNode buildNode(Class objectClass)

buildNode

protected static ClassTree.ClassTreeNode buildNode(Class objectClass,
                                                   Map allNodes)

getParents

public List getParents()

addParent

public void addParent(ClassTree.ClassTreeNode node)

removeChild

public boolean removeChild(ClassTree.ClassTreeNode node)

addChild

public void addChild(ClassTree.ClassTreeNode node)

getChildren

public List getChildren()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getObjectClass

public Class getObjectClass()

getClassName

public String getClassName()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Object obj)

Compares one class to another class by their inheritance tree.

Specified by:
compareTo in interface Comparable
Returns:
an integer representing the comparison results as follows:
2 if this is a subclass of past in object
-2 if this is a superclass of past in object
0 if they are not related (and in relation to sorting, equal)
0 if they are the same


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.