Class InheritanceSearch
- java.lang.Object
- 
- org.apache.tapestry5.commons.internal.util.InheritanceSearch
 
- 
- All Implemented Interfaces:
- java.lang.Iterable<java.lang.Class>,- java.util.Iterator<java.lang.Class>
 
 public class InheritanceSearch extends java.lang.Object implements java.util.Iterator<java.lang.Class>, java.lang.Iterable<java.lang.Class> Used to search from a particular class up the inheritance hierarchy of extended classes and implemented interfaces. The search starts with the initial class (provided in the constructor). It progresses up the inheritance chain, but skips java.lang.Object. Once classes are exhausted, the inheritance hierarchy is searched. This is a breadth-first search, rooted in the interfaces implemented by the initial class at its super classes. Once all interfaces are exhausted, java.lang.Object is returned (it is always returned last). Two minor tweak to normal inheritance rules:- Normally, the parent class of an object array is java.lang.Object, which is odd because FooService[] is assignable to Object[]. Thus, we tweak the search so that the effective super class of FooService[] is Object[].
- The "super class" of a primtive type is its wrapper type, with the exception of void, whose "super class" is left at its normal value (Object.class)
 Iterableinterface, so it can be used directly in a for loop:for (Class search : new InheritanceSearch(startClass)) { ... }This class is not thread-safe.
- 
- 
Constructor SummaryConstructors Constructor Description InheritanceSearch(java.lang.Class searchClass)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()java.util.Iterator<java.lang.Class>iterator()java.lang.Classnext()voidremove()
 
- 
- 
- 
Constructor Detail- 
InheritanceSearchpublic InheritanceSearch(java.lang.Class searchClass) 
 
- 
 - 
Method Detail- 
iteratorpublic java.util.Iterator<java.lang.Class> iterator() - Specified by:
- iteratorin interface- java.lang.Iterable<java.lang.Class>
 
 - 
hasNextpublic boolean hasNext() - Specified by:
- hasNextin interface- java.util.Iterator<java.lang.Class>
 
 - 
nextpublic java.lang.Class next() - Specified by:
- nextin interface- java.util.Iterator<java.lang.Class>
 
 - 
removepublic void remove() - Specified by:
- removein interface- java.util.Iterator<java.lang.Class>
- Throws:
- java.lang.UnsupportedOperationException- always
 
 
- 
 
-