common_helper/src/main/java/com/xiongyingqi/util/ClassHelper.java
public static boolean isImplementsInterface(Class clazz, Class enterface) {
        Assert.notNull(clazz);
        Assert.notNull(enterface);
        Class[] interfaces = clazz.getInterfaces();
        Class superclass = clazz.getSuperclass();
        if (superclass != null) {
            boolean implementsInterface = isImplementsInterface(superclass, enterface);
            if (implementsInterface) {
                return true;
            }
        }
        boolean flag = false;
        for (Class anInterface : interfaces) {
            if (enterface == anInterface) {
                return true;
            } else {
                flag = isImplementsInterface(anInterface, enterface);
                if (flag) {
                    return flag;
                }
            }
        }
        return flag;
    }
public static boolean isImplementsInterface(Class clazz, Class enterface) {
        Assert.notNull(clazz);
        Assert.notNull(enterface);
        Class[] interfaces = clazz.getInterfaces();
        Class superclass = clazz.getSuperclass();
        if (superclass != null) {
            boolean implementsInterface = isImplementsInterface(superclass, enterface);
            if (implementsInterface) {
                return true;
            }
        }
        boolean flag = false;
        for (Class anInterface : interfaces) {
            if (enterface == anInterface) {
                return true;
            } else {
                flag = isImplementsInterface(anInterface, enterface);
                if (flag) {
                    return flag;
                }
            }
        }
        return flag;
    }
public static boolean isImplementsInterface ( Class clazz , Class enterface ) { Assert . notNull ( clazz ) ; Assert . notNull ( enterface ) ; Class [ ] interfaces = clazz . getInterfaces ( ) ; Class superclass = clazz . getSuperclass ( ) ; if ( superclass != null ) { boolean implementsInterface = isImplementsInterface ( superclass , enterface ) ; if ( implementsInterface ) { return true ; } } boolean flag = false ; for ( Class anInterface : interfaces ) { if ( enterface == anInterface ) { return true ; } else { flag = isImplementsInterface ( anInterface , enterface ) ; if ( flag ) { return flag ; } } } return flag ; }
检查类是否直接或间接实现接口

@param clazz
@param enterface
@return
检查类是否直接或间接实现接口