public static Class[] resolveInterfaceTypeArguments(Class<?> type, Class<?> interfaceType) {
        Optional<Type> resolvedType = getAllGenericInterfaces(type)
                .stream()
                .filter(t -> {
                            if (t instanceof ParameterizedType) {
                                ParameterizedType pt = (ParameterizedType) t;
                                return pt.getRawType() == interfaceType;
                            }
                            return false;
                        }
                )
                .findFirst();
        return resolvedType.map(GenericTypeUtils::resolveTypeArguments)
                .orElse(ReflectionUtils.EMPTY_CLASS_ARRAY);
    }
public static Class [ ] resolveInterfaceTypeArguments ( Class < ? > type , Class < ? > interfaceType ) { Optional < Type > resolvedType = getAllGenericInterfaces ( type ) . stream ( ) . filter ( t -> { if ( t instanceof ParameterizedType ) { ParameterizedType pt = ( ParameterizedType ) t ; return pt . getRawType ( ) == interfaceType ; } return false ; } ) . findFirst ( ) ; return resolvedType . map ( GenericTypeUtils :: resolveTypeArguments ) . orElse ( ReflectionUtils . EMPTY_CLASS_ARRAY ) ; }
Resolve all of the type arguments for the given interface from the given type. Also
searches superclasses.

@param type          The type to resolve from
@param interfaceType The interface to resolve from
@return The type arguments to the interface