DATACMNS-1762 - Polishing.
Update JavaDoc, remove unused imports and reduce method visibility. Original Pull Request: #459
This commit is contained in:
@@ -35,7 +35,6 @@ import org.springframework.data.mapping.PreferredConstructor;
|
||||
import org.springframework.data.mapping.PreferredConstructor.Parameter;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.KotlinReflectionUtils;
|
||||
import org.springframework.data.util.ReflectionUtils;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -182,7 +182,7 @@ class ProjectingMethodInterceptor implements MethodInterceptor {
|
||||
* a single-element collection.
|
||||
*
|
||||
* @param source must not be {@literal null}.
|
||||
* @return
|
||||
* @return never {@literal null}.
|
||||
*/
|
||||
private static Collection<?> asCollection(Object source) {
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
|
||||
|
||||
/**
|
||||
* {@link ApplicationListener} to trigger the initialization of Spring Data repositories right before the application
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import org.springframework.beans.factory.config.DependencyDescriptor;
|
||||
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
|
||||
@@ -41,7 +40,6 @@ import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.repository.core.support;
|
||||
|
||||
import static org.springframework.core.GenericTypeResolver.*;
|
||||
|
||||
import java.lang.reflect.GenericDeclaration;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
@@ -322,8 +320,8 @@ interface MethodLookups {
|
||||
* Returns a candidate method from the base class for the given one or the method given in the first place if none
|
||||
* one the base class matches.
|
||||
*
|
||||
* @param method must not be {@literal null}.
|
||||
* @param baseClass must not be {@literal null}.
|
||||
* @param invokedMethod must not be {@literal null}.
|
||||
* @param candidate must not be {@literal null}.
|
||||
* @param predicate must not be {@literal null}.
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -54,7 +54,7 @@ class QueryExecutionResultHandler {
|
||||
/**
|
||||
* Creates a new {@link QueryExecutionResultHandler}.
|
||||
*/
|
||||
public QueryExecutionResultHandler(GenericConversionService conversionService) {
|
||||
QueryExecutionResultHandler(GenericConversionService conversionService) {
|
||||
this.conversionService = conversionService;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ class QueryExecutionResultHandler {
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
public Object postProcessInvocationResult(@Nullable Object result, Method method) {
|
||||
Object postProcessInvocationResult(@Nullable Object result, Method method) {
|
||||
|
||||
if (!processingRequired(result, method.getReturnType())) {
|
||||
return result;
|
||||
@@ -172,6 +172,7 @@ class QueryExecutionResultHandler {
|
||||
: null;
|
||||
|
||||
}
|
||||
|
||||
private boolean requiresConversion(Collection<?> collection, Class<?> expectedReturnType,
|
||||
@Nullable TypeDescriptor elementDescriptor) {
|
||||
|
||||
@@ -276,7 +277,7 @@ class QueryExecutionResultHandler {
|
||||
* @see TypeDescriptor#nested(MethodParameter, int)
|
||||
*/
|
||||
@Nullable
|
||||
public TypeDescriptor getReturnTypeDescriptor(int nestingLevel) {
|
||||
TypeDescriptor getReturnTypeDescriptor(int nestingLevel) {
|
||||
|
||||
// optimizing for nesting level 0 and 1 (Optional<T>, List<T>)
|
||||
// nesting level 2 (Optional<List<T>>) uses the slow path.
|
||||
|
||||
@@ -257,7 +257,7 @@ public abstract class QueryExecutionConverters {
|
||||
* Returns the {@link ExecutionAdapter} to be used for the given return type.
|
||||
*
|
||||
* @param returnType must not be {@literal null}.
|
||||
* @return
|
||||
* @return can be {@literal null}.
|
||||
*/
|
||||
@Nullable
|
||||
public static ExecutionAdapter getExecutionAdapter(Class<?> returnType) {
|
||||
@@ -289,10 +289,9 @@ public abstract class QueryExecutionConverters {
|
||||
/**
|
||||
* Creates a new {@link AbstractWrapperTypeConverter} using the given {@link ConversionService} and wrapper type.
|
||||
*
|
||||
* @param conversionService must not be {@literal null}.
|
||||
* @param nullValue must not be {@literal null}.
|
||||
*/
|
||||
protected AbstractWrapperTypeConverter(Object nullValue) {
|
||||
AbstractWrapperTypeConverter(Object nullValue) {
|
||||
|
||||
Assert.notNull(nullValue, "Null value must not be null!");
|
||||
|
||||
@@ -300,7 +299,7 @@ public abstract class QueryExecutionConverters {
|
||||
this.wrapperTypes = Collections.singleton(nullValue.getClass());
|
||||
}
|
||||
|
||||
public AbstractWrapperTypeConverter(Object nullValue,
|
||||
AbstractWrapperTypeConverter(Object nullValue,
|
||||
Iterable<Class<?>> wrapperTypes) {
|
||||
this.nullValue = nullValue;
|
||||
this.wrapperTypes = wrapperTypes;
|
||||
@@ -356,10 +355,8 @@ public abstract class QueryExecutionConverters {
|
||||
|
||||
/**
|
||||
* Creates a new {@link NullableWrapperToFutureConverter} using the given {@link ConversionService}.
|
||||
*
|
||||
* @param conversionService must not be {@literal null}.
|
||||
*/
|
||||
public NullableWrapperToFutureConverter() {
|
||||
NullableWrapperToFutureConverter() {
|
||||
super(new AsyncResult<>(null), Arrays.asList(Future.class, ListenableFuture.class));
|
||||
}
|
||||
|
||||
@@ -382,10 +379,8 @@ public abstract class QueryExecutionConverters {
|
||||
|
||||
/**
|
||||
* Creates a new {@link NullableWrapperToCompletableFutureConverter} using the given {@link ConversionService}.
|
||||
*
|
||||
* @param conversionService must not be {@literal null}.
|
||||
*/
|
||||
public NullableWrapperToCompletableFutureConverter() {
|
||||
NullableWrapperToCompletableFutureConverter() {
|
||||
super(CompletableFuture.completedFuture(null));
|
||||
}
|
||||
|
||||
@@ -398,7 +393,7 @@ public abstract class QueryExecutionConverters {
|
||||
return source instanceof CompletableFuture ? source : CompletableFuture.completedFuture(source);
|
||||
}
|
||||
|
||||
public static WrapperType getWrapperType() {
|
||||
static WrapperType getWrapperType() {
|
||||
return WrapperType.singleValue(CompletableFuture.class);
|
||||
}
|
||||
}
|
||||
@@ -438,7 +433,7 @@ public abstract class QueryExecutionConverters {
|
||||
private final Map<TypeDescriptor, Boolean> targetTypeCache = new ConcurrentHashMap<>();
|
||||
private final ConversionService conversionService = DefaultConversionService.getSharedInstance();
|
||||
|
||||
public IterableToStreamableConverter() {}
|
||||
IterableToStreamableConverter() {}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ public class NullableWrapper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the contained value. WIll fall back to {@link Object} in case the value is {@literal null}.
|
||||
* Returns the type of the contained value. Will fall back to {@link Object} in case the value is {@literal null}.
|
||||
*
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2020 the original author or authors.
|
||||
* Copyright 2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -228,7 +228,6 @@ public abstract class NullableWrapperConverters {
|
||||
/**
|
||||
* Creates a new {@link AbstractWrapperTypeConverter} using the given wrapper type.
|
||||
*
|
||||
* @param conversionService must not be {@literal null}.
|
||||
* @param nullValue must not be {@literal null}.
|
||||
*/
|
||||
protected AbstractWrapperTypeConverter(Object nullValue) {
|
||||
@@ -501,11 +500,11 @@ public abstract class NullableWrapperConverters {
|
||||
this.cardinality = cardinality;
|
||||
}
|
||||
|
||||
public Class<?> getType() {
|
||||
Class<?> getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public Cardinality getCardinality() {
|
||||
Cardinality getCardinality() {
|
||||
return cardinality;
|
||||
}
|
||||
|
||||
@@ -560,19 +559,19 @@ public abstract class NullableWrapperConverters {
|
||||
private final Class<?> type;
|
||||
private final Cardinality cardinality;
|
||||
|
||||
public static WrapperType singleValue(Class<?> type) {
|
||||
static WrapperType singleValue(Class<?> type) {
|
||||
return new WrapperType(type, Cardinality.SINGLE);
|
||||
}
|
||||
|
||||
public static WrapperType multiValue(Class<?> type) {
|
||||
static WrapperType multiValue(Class<?> type) {
|
||||
return new WrapperType(type, Cardinality.MULTI);
|
||||
}
|
||||
|
||||
public static WrapperType noValue(Class<?> type) {
|
||||
static WrapperType noValue(Class<?> type) {
|
||||
return new WrapperType(type, Cardinality.NONE);
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
boolean isSingleValue() {
|
||||
return cardinality.equals(Cardinality.SINGLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.log.LogMessage;
|
||||
|
||||
Reference in New Issue
Block a user