code: public static boolean superclassHierarchyContains(Class<?> haystack, Class<?> needle)
     {
        Class<?> superclass = haystack;
        while (superclass != null && superclass != needle)
        {
           superclass = superclass.getSuperclass();
        }
        return superclass == needle;
     }
docs: Search the given {@link Class} hierarchy for the specified {@link Class}.