Skip to content

Commit f261220

Browse files
DATACMNS-1762 - Polishing.
Update JavaDoc, remove unused imports and reduce method visibility. Original Pull Request: #459
1 parent 97df0fa commit f261220

10 files changed

+23
-36
lines changed

src/main/java/org/springframework/data/mapping/model/PreferredConstructorDiscoverer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.springframework.data.mapping.PreferredConstructor.Parameter;
3636
import org.springframework.data.util.ClassTypeInformation;
3737
import org.springframework.data.util.KotlinReflectionUtils;
38-
import org.springframework.data.util.ReflectionUtils;
3938
import org.springframework.data.util.TypeInformation;
4039
import org.springframework.lang.Nullable;
4140
import org.springframework.util.Assert;

src/main/java/org/springframework/data/projection/ProjectingMethodInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private boolean conversionRequiredAndPossible(Object source, Class<?> targetType
182182
* a single-element collection.
183183
*
184184
* @param source must not be {@literal null}.
185-
* @return
185+
* @return never {@literal null}.
186186
*/
187187
private static Collection<?> asCollection(Object source) {
188188

src/main/java/org/springframework/data/repository/config/DeferredRepositoryInitializationListener.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.springframework.context.event.ContextRefreshedEvent;
2424
import org.springframework.core.Ordered;
2525
import org.springframework.data.repository.Repository;
26-
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
2726

2827
/**
2928
* {@link ApplicationListener} to trigger the initialization of Spring Data repositories right before the application

src/main/java/org/springframework/data/repository/config/RepositoryConfigurationDelegate.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import org.apache.commons.logging.Log;
2727
import org.apache.commons.logging.LogFactory;
28-
import org.slf4j.Logger;
2928

3029
import org.springframework.beans.factory.config.DependencyDescriptor;
3130
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
@@ -41,7 +40,6 @@
4140
import org.springframework.core.io.ResourceLoader;
4241
import org.springframework.core.io.support.SpringFactoriesLoader;
4342
import org.springframework.core.log.LogMessage;
44-
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
4543
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
4644
import org.springframework.lang.Nullable;
4745
import org.springframework.util.Assert;

src/main/java/org/springframework/data/repository/core/support/MethodLookups.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
package org.springframework.data.repository.core.support;
1717

18-
import static org.springframework.core.GenericTypeResolver.*;
19-
2018
import java.lang.reflect.GenericDeclaration;
2119
import java.lang.reflect.Method;
2220
import java.lang.reflect.Type;
@@ -322,8 +320,8 @@ private static boolean usesParametersWithReactiveWrappers(Method method) {
322320
* Returns a candidate method from the base class for the given one or the method given in the first place if none
323321
* one the base class matches.
324322
*
325-
* @param method must not be {@literal null}.
326-
* @param baseClass must not be {@literal null}.
323+
* @param invokedMethod must not be {@literal null}.
324+
* @param candidate must not be {@literal null}.
327325
* @param predicate must not be {@literal null}.
328326
* @return
329327
*/

src/main/java/org/springframework/data/repository/core/support/QueryExecutionResultHandler.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class QueryExecutionResultHandler {
5454
/**
5555
* Creates a new {@link QueryExecutionResultHandler}.
5656
*/
57-
public QueryExecutionResultHandler(GenericConversionService conversionService) {
57+
QueryExecutionResultHandler(GenericConversionService conversionService) {
5858
this.conversionService = conversionService;
5959
}
6060

@@ -66,7 +66,7 @@ public QueryExecutionResultHandler(GenericConversionService conversionService) {
6666
* @return
6767
*/
6868
@Nullable
69-
public Object postProcessInvocationResult(@Nullable Object result, Method method) {
69+
Object postProcessInvocationResult(@Nullable Object result, Method method) {
7070

7171
if (!processingRequired(result, method.getReturnType())) {
7272
return result;
@@ -172,6 +172,7 @@ Object postProcessInvocationResult(@Nullable Object result, int nestingLevel, Re
172172
: null;
173173

174174
}
175+
175176
private boolean requiresConversion(Collection<?> collection, Class<?> expectedReturnType,
176177
@Nullable TypeDescriptor elementDescriptor) {
177178

@@ -276,7 +277,7 @@ public static ReturnTypeDescriptor of(Method method) {
276277
* @see TypeDescriptor#nested(MethodParameter, int)
277278
*/
278279
@Nullable
279-
public TypeDescriptor getReturnTypeDescriptor(int nestingLevel) {
280+
TypeDescriptor getReturnTypeDescriptor(int nestingLevel) {
280281

281282
// optimizing for nesting level 0 and 1 (Optional<T>, List<T>)
282283
// nesting level 2 (Optional<List<T>>) uses the slow path.

src/main/java/org/springframework/data/repository/util/QueryExecutionConverters.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public static TypeInformation<?> unwrapWrapperTypes(TypeInformation<?> type) {
257257
* Returns the {@link ExecutionAdapter} to be used for the given return type.
258258
*
259259
* @param returnType must not be {@literal null}.
260-
* @return
260+
* @return can be {@literal null}.
261261
*/
262262
@Nullable
263263
public static ExecutionAdapter getExecutionAdapter(Class<?> returnType) {
@@ -289,18 +289,17 @@ private static abstract class AbstractWrapperTypeConverter implements GenericCon
289289
/**
290290
* Creates a new {@link AbstractWrapperTypeConverter} using the given {@link ConversionService} and wrapper type.
291291
*
292-
* @param conversionService must not be {@literal null}.
293292
* @param nullValue must not be {@literal null}.
294293
*/
295-
protected AbstractWrapperTypeConverter(Object nullValue) {
294+
AbstractWrapperTypeConverter(Object nullValue) {
296295

297296
Assert.notNull(nullValue, "Null value must not be null!");
298297

299298
this.nullValue = nullValue;
300299
this.wrapperTypes = Collections.singleton(nullValue.getClass());
301300
}
302301

303-
public AbstractWrapperTypeConverter(Object nullValue,
302+
AbstractWrapperTypeConverter(Object nullValue,
304303
Iterable<Class<?>> wrapperTypes) {
305304
this.nullValue = nullValue;
306305
this.wrapperTypes = wrapperTypes;
@@ -356,10 +355,8 @@ private static class NullableWrapperToFutureConverter extends AbstractWrapperTyp
356355

357356
/**
358357
* Creates a new {@link NullableWrapperToFutureConverter} using the given {@link ConversionService}.
359-
*
360-
* @param conversionService must not be {@literal null}.
361358
*/
362-
public NullableWrapperToFutureConverter() {
359+
NullableWrapperToFutureConverter() {
363360
super(new AsyncResult<>(null), Arrays.asList(Future.class, ListenableFuture.class));
364361
}
365362

@@ -382,10 +379,8 @@ private static class NullableWrapperToCompletableFutureConverter extends Abstrac
382379

383380
/**
384381
* Creates a new {@link NullableWrapperToCompletableFutureConverter} using the given {@link ConversionService}.
385-
*
386-
* @param conversionService must not be {@literal null}.
387382
*/
388-
public NullableWrapperToCompletableFutureConverter() {
383+
NullableWrapperToCompletableFutureConverter() {
389384
super(CompletableFuture.completedFuture(null));
390385
}
391386

@@ -398,7 +393,7 @@ protected Object wrap(Object source) {
398393
return source instanceof CompletableFuture ? source : CompletableFuture.completedFuture(source);
399394
}
400395

401-
public static WrapperType getWrapperType() {
396+
static WrapperType getWrapperType() {
402397
return WrapperType.singleValue(CompletableFuture.class);
403398
}
404399
}
@@ -438,7 +433,7 @@ private static class IterableToStreamableConverter implements ConditionalGeneric
438433
private final Map<TypeDescriptor, Boolean> targetTypeCache = new ConcurrentHashMap<>();
439434
private final ConversionService conversionService = DefaultConversionService.getSharedInstance();
440435

441-
public IterableToStreamableConverter() {}
436+
IterableToStreamableConverter() {}
442437

443438
/*
444439
* (non-Javadoc)

src/main/java/org/springframework/data/util/NullableWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ public NullableWrapper(@Nullable Object value) {
4141
}
4242

4343
/**
44-
* Returns the type of the contained value. WIll fall back to {@link Object} in case the value is {@literal null}.
44+
* Returns the type of the contained value. Will fall back to {@link Object} in case the value is {@literal null}.
4545
*
4646
* @return will never be {@literal null}.
4747
*/

src/main/java/org/springframework/data/util/NullableWrapperConverters.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 the original author or authors.
2+
* Copyright 2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -228,7 +228,6 @@ private static abstract class AbstractWrapperTypeConverter implements GenericCon
228228
/**
229229
* Creates a new {@link AbstractWrapperTypeConverter} using the given wrapper type.
230230
*
231-
* @param conversionService must not be {@literal null}.
232231
* @param nullValue must not be {@literal null}.
233232
*/
234233
protected AbstractWrapperTypeConverter(Object nullValue) {
@@ -501,11 +500,11 @@ private WrapperType(Class<?> type, Cardinality cardinality) {
501500
this.cardinality = cardinality;
502501
}
503502

504-
public Class<?> getType() {
503+
Class<?> getType() {
505504
return this.type;
506505
}
507506

508-
public Cardinality getCardinality() {
507+
Cardinality getCardinality() {
509508
return cardinality;
510509
}
511510

@@ -560,19 +559,19 @@ enum Cardinality {
560559
private final Class<?> type;
561560
private final Cardinality cardinality;
562561

563-
public static WrapperType singleValue(Class<?> type) {
562+
static WrapperType singleValue(Class<?> type) {
564563
return new WrapperType(type, Cardinality.SINGLE);
565564
}
566565

567-
public static WrapperType multiValue(Class<?> type) {
566+
static WrapperType multiValue(Class<?> type) {
568567
return new WrapperType(type, Cardinality.MULTI);
569568
}
570569

571-
public static WrapperType noValue(Class<?> type) {
570+
static WrapperType noValue(Class<?> type) {
572571
return new WrapperType(type, Cardinality.NONE);
573572
}
574573

575-
public boolean isSingleValue() {
574+
boolean isSingleValue() {
576575
return cardinality.equals(Cardinality.SINGLE);
577576
}
578577
}

src/main/java/org/springframework/data/web/PagedResourcesAssemblerArgumentResolver.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
import org.apache.commons.logging.Log;
2424
import org.apache.commons.logging.LogFactory;
25-
import org.slf4j.Logger;
26-
import org.slf4j.LoggerFactory;
2725
import org.springframework.beans.factory.annotation.Qualifier;
2826
import org.springframework.core.MethodParameter;
2927
import org.springframework.core.log.LogMessage;

0 commit comments

Comments
 (0)