public static boolean hasSuperClass ( Class < ? > clazz , Class < ? > superClazz ) { if ( clazz == null || superClazz == null || clazz == superClazz ) { return false ; } if ( clazz . isInterface ( ) ) { return superClazz . isAssignableFrom ( clazz ) ; } Class < ? > parent = clazz . getSuperclass ( ) ; while ( parent != null ) { if ( parent == superClazz ) { return true ; } parent = parent . getSuperclass ( ) ; } return false ; }
Tells if a class is a sub - class of a super - class .