DATACOUCH-314 - Adopt to ReactiveCrudRepository.findById(Publisher) and existsById(Publisher).

Related ticket: DATACMNS-1063.

Original Pull Request: #147
This commit is contained in:
Mark Paluch
2017-06-09 11:40:27 +02:00
committed by Christoph Strobl
parent cd74219bbb
commit 55832cfa21

View File

@@ -130,9 +130,9 @@ public class SimpleReactiveCouchbaseRepository<T, ID extends Serializable> imple
@SuppressWarnings("unchecked")
@Override
public Mono<T> findById(Mono<ID> mono) {
Assert.notNull(mono, "The given mono must not be null!");
return mono.flatMap(
public Mono<T> findById(Publisher<ID> publisher) {
Assert.notNull(publisher, "The given Publisher must not be null!");
return Mono.from(publisher).flatMap(
this::findById);
}
@@ -145,8 +145,9 @@ public class SimpleReactiveCouchbaseRepository<T, ID extends Serializable> imple
@SuppressWarnings("unchecked")
@Override
public Mono<Boolean> existsById(Mono<ID> mono) {
return mono.flatMap(
public Mono<Boolean> existsById(Publisher<ID> publisher) {
Assert.notNull(publisher, "The given Publisher must not be null!");
return Mono.from(publisher).flatMap(
this::existsById);
}
@@ -180,7 +181,7 @@ public class SimpleReactiveCouchbaseRepository<T, ID extends Serializable> imple
public Flux<T> findAllById(Publisher<ID> entityStream) {
Assert.notNull(entityStream, "The given entityStream must not be null!");
return Flux.from(entityStream)
.flatMap(entity -> findById(entity));
.flatMap(this::findById);
}
@SuppressWarnings("unchecked")