default <T extends RegisteredService> T findServiceByName(final String name, final Class<T> clazz) {
        val service = findServiceByName(name);
        if (service != null && clazz.isAssignableFrom(service.getClass())) {
            return (T) service;
        }
        return null;
    }
Find a {@link RegisteredService} by matching with the supplied name.

@param <T>   the type parameter
@param name  the name to match with.
@param clazz the clazz
@return the {@link RegisteredService} that matches the supplied service.
api/cas-server-core-api-services/src/main/java/org/apereo/cas/services/ServicesManager.java