public static Type getTypeHierarchy ( List < Type > typeHierarchy , Type t , Class < ? > stopAtClass ) { while ( ! ( isClassType ( t ) && typeToClass ( t ) . equals ( stopAtClass ) ) ) { typeHierarchy . add ( t ) ; t = typeToClass ( t ) . getGenericSuperclass ( ) ; if ( t == null ) { break ; } } return t ; }
Traverses the type hierarchy of a type up until a certain stop class is found .