DATACMNS-1097 - Polishing.

Updated Sonargraph architecture description. Polished imports in domain package to avoid unnecessary imports (mostly due to Javadoc references).

Removed manually declared constructor in ExampleMatcherAccessor in favor of Lombok's @RequiredArgsConstructor. Removed deprecations in type information subsystem. Moved to different way of class loading to avoid null pointer warnings in ReflectionUtils.
This commit is contained in:
Oliver Gierke
2017-07-05 18:02:49 +02:00
parent 1fc25727cf
commit 24704fc4de
7 changed files with 86 additions and 77 deletions

View File

@@ -20,14 +20,12 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.ApplicationEventPublisher;
/**
* {@link DomainEvents} can be used on methods of aggregate roots managed by Spring Data repositories to publish the
* events returned by that method as Spring application events.
*
* @author Oliver Gierke
* @see ApplicationEventPublisher
* @see org.springframework.context.ApplicationEventPublisher
* @see AfterDomainEventPublication
* @since 1.13
* @soundtrack Benny Greb - Soulfood (Moving Parts Live)

View File

@@ -17,8 +17,6 @@ package org.springframework.data.domain;
import java.util.function.Function;
import org.springframework.core.convert.converter.Converter;
/**
* A page is a sublist of a list of objects. It allows gain information about the position of it in the containing
* entire list.
@@ -43,10 +41,10 @@ public interface Page<T> extends Slice<T> {
long getTotalElements();
/**
* Returns a new {@link Page} with the content of the current one mapped by the given {@link Converter}.
* Returns a new {@link Page} with the content of the current one mapped by the given {@link Function}.
*
* @param converter must not be {@literal null}.
* @return a new {@link Page} with the content of the current one mapped by the given {@link Converter}.
* @return a new {@link Page} with the content of the current one mapped by the given {@link Function}.
* @since 1.10
*/
<U> Page<U> map(Function<? super T, ? extends U> converter);

View File

@@ -15,12 +15,13 @@
*/
package org.springframework.data.support;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.util.Collection;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.ExampleMatcher.PropertySpecifier;
import org.springframework.data.util.StringMatcher;
import org.springframework.util.Assert;
/**
* Accessor for the {@link ExampleMatcher} to use in modules that support query by example (QBE) querying.
@@ -31,21 +32,10 @@ import org.springframework.util.Assert;
* @author Jens Schauder
* @since 1.12
*/
@RequiredArgsConstructor
public class ExampleMatcherAccessor {
private final ExampleMatcher matcher;
/**
* Creates a new {@link ExampleMatcherAccessor} for the given {@link ExampleMatcher}.
*
* @param matcher must not be {@literal null}.
*/
public ExampleMatcherAccessor(ExampleMatcher matcher) {
Assert.notNull(matcher, "ExampleMatcher must not be null!");
this.matcher = matcher;
}
private final @NonNull ExampleMatcher matcher;
/**
* Returns the {@link PropertySpecifier}s of the underlying {@link ExampleMatcher}.

View File

@@ -117,7 +117,6 @@ public class ClassTypeInformation<S> extends TypeDiscoverer<S> {
return getTypeVariableMap(type, new HashSet<>());
}
@SuppressWarnings("deprecation")
private static Map<TypeVariable<?>, Type> getTypeVariableMap(Class<?> type, Collection<Type> visited) {
if (visited.contains(type)) {

View File

@@ -60,7 +60,7 @@ public class ReflectionUtils {
public static <T> T createInstanceIfPresent(String classname, T defaultInstance) {
try {
Class<?> type = ClassUtils.getDefaultClassLoader().loadClass(classname);
Class<?> type = ClassUtils.forName(classname, ClassUtils.getDefaultClassLoader());
return (T) BeanUtils.instantiateClass(type);
} catch (Exception e) {
return defaultInstance;

View File

@@ -115,7 +115,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
* @param fieldType must not be {@literal null}.
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked", "deprecation" })
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TypeInformation<?> createInfo(Type fieldType) {
Assert.notNull(fieldType, "Field type must not be null!");
@@ -180,7 +180,7 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
* @param type
* @return
*/
@SuppressWarnings({ "unchecked", "rawtypes", "deprecation" })
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Class<S> resolveType(Type type) {
Map<TypeVariable, Type> map = new HashMap<>();