public static Set<Class> getAllInterfacesForClassAsSet(Class clazz, ClassLoader classLoader) {
        Assert.notNull(clazz, "Class must not be null");
        Set<Class> interfaces = new LinkedHashSet<Class>();
        while (clazz != null) {
            Class<?>[] ifcs = clazz.getInterfaces();
            for (Class<?> ifc : ifcs) {
                interfaces.add(ifc);
                interfaces.addAll(getAllInterfacesForClassAsSet(ifc, classLoader));
            }
            clazz = clazz.getSuperclass();
        }
        return interfaces;
    }
public static Set < Class > getAllInterfacesForClassAsSet ( Class clazz , ClassLoader classLoader ) { Assert . notNull ( clazz , "Class must not be null" ) ; Set < Class > interfaces = new LinkedHashSet < Class > ( ) ; while ( clazz != null ) { Class < ? > [ ] ifcs = clazz . getInterfaces ( ) ; for ( Class < ? > ifc : ifcs ) { interfaces . add ( ifc ) ; interfaces . addAll ( getAllInterfacesForClassAsSet ( ifc , classLoader ) ) ; } clazz = clazz . getSuperclass ( ) ; } return interfaces ; }
Return all interfaces that the given class implements as Set,
including ones implemented by superclasses.
<p>If the class itself is an interface, it gets returned as sole interface.
@param clazz the class to analyze for interfaces
@param classLoader the ClassLoader that the interfaces need to be visible in
(may be {@code null} when accepting all declared interfaces)
@return all interfaces that the given object implements as Set