class SW360ReleaseClientAdapterAsyncImpl implements SW360ReleaseClientAdapterAsync {

    @Override
    public CompletableFuture<Optional<SW360SparseRelease>> getSparseReleaseByNameAndVersion(String componentName,
                                                                                            String version) {
        return getComponentAdapter().getComponentByName(componentName)
                .thenApply(optComponent ->
                        optComponent.map(SW360Component::getEmbedded)
                                .map(SW360ComponentEmbedded::getReleases)
                                .flatMap(releases -> releases.stream()
                                        .filter(rel -> version.equals(rel.getVersion()))
                                        .findFirst()));

    }

    public  SW360ReleaseClientAdapterAsyncImpl(SW360ReleaseClient client,
                                              SW360ComponentClientAdapterAsync componentClientAdapter);

}