From 2dababc43bc4a09175a61835e3337c73652aaf65 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 20 Mar 2023 08:17:58 +0100 Subject: [PATCH] Polishing. Make fields final where applicable, move off deprecated API. See #1696 --- .../repository/query/N1qlCountQueryCreator.java | 4 ++-- .../query/ReactiveCouchbaseParameterAccessor.java | 2 +- .../query/ReactiveCouchbaseQueryMethod.java | 11 ++++------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/springframework/data/couchbase/repository/query/N1qlCountQueryCreator.java b/src/main/java/org/springframework/data/couchbase/repository/query/N1qlCountQueryCreator.java index a81d81c2..c47a01c5 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/query/N1qlCountQueryCreator.java +++ b/src/main/java/org/springframework/data/couchbase/repository/query/N1qlCountQueryCreator.java @@ -45,7 +45,7 @@ public class N1qlCountQueryCreator extends OldN1qlQueryCreator { private static class CountParameterAccessor implements ParameterAccessor { - private ParameterAccessor delegate; + private final ParameterAccessor delegate; public CountParameterAccessor(ParameterAccessor delegate) { this.delegate = delegate; @@ -85,7 +85,7 @@ public class N1qlCountQueryCreator extends OldN1qlQueryCreator { private static class CountPageable implements Pageable { - private Pageable delegate; + private final Pageable delegate; public CountPageable(Pageable delegate) { this.delegate = delegate; diff --git a/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseParameterAccessor.java b/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseParameterAccessor.java index 0495ff27..63cc1a35 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseParameterAccessor.java +++ b/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseParameterAccessor.java @@ -28,7 +28,7 @@ import org.reactivestreams.Publisher; import org.springframework.data.repository.query.ParametersParameterAccessor; import org.springframework.data.repository.util.ReactiveWrapperConverters; -import org.springframework.data.repository.util.ReactiveWrappers; +import org.springframework.data.util.ReactiveWrappers; /** * Reactive {@link org.springframework.data.repository.query.ParametersParameterAccessor} implementation that subscribes diff --git a/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseQueryMethod.java b/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseQueryMethod.java index add63730..d7c6cf45 100644 --- a/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseQueryMethod.java +++ b/src/main/java/org/springframework/data/couchbase/repository/query/ReactiveCouchbaseQueryMethod.java @@ -29,8 +29,7 @@ import org.springframework.data.domain.Sort; import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.projection.ProjectionFactory; import org.springframework.data.repository.core.RepositoryMetadata; -import org.springframework.data.repository.util.ReactiveWrappers; -import org.springframework.data.util.ClassTypeInformation; +import org.springframework.data.util.ReactiveWrappers; import org.springframework.data.util.Lazy; import org.springframework.data.util.TypeInformation; import org.springframework.util.ClassUtils; @@ -43,10 +42,9 @@ import org.springframework.util.ClassUtils; */ public class ReactiveCouchbaseQueryMethod extends CouchbaseQueryMethod { - private static final ClassTypeInformation PAGE_TYPE = ClassTypeInformation.from(Page.class); - private static final ClassTypeInformation SLICE_TYPE = ClassTypeInformation.from(Slice.class); + private static final TypeInformation PAGE_TYPE = TypeInformation.of(Page.class); + private static final TypeInformation SLICE_TYPE = TypeInformation.of(Slice.class); - private final Method method; private final Lazy isCollectionQueryCouchbase; // not to be confused with QueryMethod.isCollectionQuery /** @@ -64,7 +62,7 @@ public class ReactiveCouchbaseQueryMethod extends CouchbaseQueryMethod { if (hasParameterOfType(method, Pageable.class)) { - TypeInformation returnType = ClassTypeInformation.fromReturnTypeOf(method); + TypeInformation returnType = TypeInformation.fromReturnTypeOf(method); boolean multiWrapper = ReactiveWrappers.isMultiValueType(returnType.getType()); boolean singleWrapperWithWrappedPageableResult = ReactiveWrappers.isSingleValueType(returnType.getType()) @@ -89,7 +87,6 @@ public class ReactiveCouchbaseQueryMethod extends CouchbaseQueryMethod { } } - this.method = method; this.isCollectionQueryCouchbase = Lazy.of(() -> { boolean result = !(isPageQuery() || isSliceQuery()) && ReactiveWrappers.isMultiValueType(metadata.getReturnType(method).getType());