From 55832cfa21dc2a903ca683ca09a58d9af4ab7a62 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 9 Jun 2017 11:40:27 +0200 Subject: [PATCH] DATACOUCH-314 - Adopt to ReactiveCrudRepository.findById(Publisher) and existsById(Publisher). Related ticket: DATACMNS-1063. Original Pull Request: #147 --- .../support/SimpleReactiveCouchbaseRepository.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java index 9ed0af87..e56d1770 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java +++ b/src/main/java/org/springframework/data/couchbase/repository/support/SimpleReactiveCouchbaseRepository.java @@ -130,9 +130,9 @@ public class SimpleReactiveCouchbaseRepository imple @SuppressWarnings("unchecked") @Override - public Mono findById(Mono mono) { - Assert.notNull(mono, "The given mono must not be null!"); - return mono.flatMap( + public Mono findById(Publisher 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 imple @SuppressWarnings("unchecked") @Override - public Mono existsById(Mono mono) { - return mono.flatMap( + public Mono existsById(Publisher 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 imple public Flux findAllById(Publisher entityStream) { Assert.notNull(entityStream, "The given entityStream must not be null!"); return Flux.from(entityStream) - .flatMap(entity -> findById(entity)); + .flatMap(this::findById); } @SuppressWarnings("unchecked")