|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.core.util.reflection.ClassTree
This class creates a tree structure that maps inheritance hierarchies of classes. A developer can place any number of classes into this object and retrieve the closest super class or the class itself.
Copyright 2001 Sapient
Nested Class Summary | |
static class |
ClassTree.ClassTreeNode
Inner class representing each node in the tree. |
Field Summary | |
protected ClassTree.ClassTreeNode |
bottom
|
Constructor Summary | |
ClassTree(Class specificClass)
Constructs a ClassTree that represents all classes and interfaces that are generalizations of the provided class. |
Method Summary | |
private void |
buildList(ClassTree.ClassTreeNode node,
List output)
Build breadth first in order to maintain sudo ordering as per class declarations (i.e. |
ClassTree.ClassTreeNode |
getBottom()
|
List |
getOrderedList()
Constructs an ordered list starting at the highest (most general) class in the tree and moving down the tree, ensuring no generalization comes after one of its specializations. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ClassTree.ClassTreeNode bottom
Constructor Detail |
public ClassTree(Class specificClass)
specificClass
- The class to build the tree for.Method Detail |
public ClassTree.ClassTreeNode getBottom()
public List getOrderedList()
private void buildList(ClassTree.ClassTreeNode node, List output)
Build breadth first in order to maintain sudo ordering as per class declarations (i.e. if A implements B, C... B is closer in the chain to A than C is, because B comes first in the implements clause.
Note that the list coming out here is preordered, but not natural ordered. (i.e. some classes are out of order in relation to classes they have direct relationships with. This is later fixed by a sort on the list by natural ordering. Collecitons.sort, does preserve the preordering for nodes that have no relationship.
node
- the node to be browsed.output
- this list is altered to add the contents as they are
browsed in breadth-first order. Start with a list containing only
the bottom node.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |