DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters. Additionally remove unused imports and replace single element list initialization with dedicated singletonList. Use Assertion overloads taking Supplier for dynamic assertion error messages.
This commit is contained in:
committed by
Oliver Gierke
parent
aa4c51e1ea
commit
be347eaaab
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.util.Assert;
|
||||
* Helper value to abstract an accessor.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @soundtrack Benny Greb - Soulfood (Live)
|
||||
* @since 1.13
|
||||
*/
|
||||
@@ -46,7 +47,7 @@ public final class Accessor {
|
||||
this.descriptor = BeanUtils.findPropertyForMethod(method);
|
||||
this.method = method;
|
||||
|
||||
Assert.notNull(descriptor, String.format("Invoked method %s is no accessor method!", method));
|
||||
Assert.notNull(descriptor, () -> String.format("Invoked method %s is no accessor method!", method));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2017 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.
|
||||
@@ -20,11 +20,9 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.util.ReflectionUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -32,6 +30,7 @@ import org.springframework.util.Assert;
|
||||
* properties.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @since 1.12
|
||||
*/
|
||||
class DefaultProjectionInformation implements ProjectionInformation {
|
||||
@@ -102,7 +101,7 @@ class DefaultProjectionInformation implements ProjectionInformation {
|
||||
*/
|
||||
private static List<PropertyDescriptor> collectDescriptors(Class<?> type) {
|
||||
|
||||
List<PropertyDescriptor> result = new ArrayList<PropertyDescriptor>();
|
||||
List<PropertyDescriptor> result = new ArrayList<>();
|
||||
result.addAll(Arrays.stream(BeanUtils.getPropertyDescriptors(type))//
|
||||
.filter(it -> !hasDefaultGetter(it))//
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -39,6 +39,7 @@ import org.springframework.util.ClassUtils;
|
||||
* types.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @see SpelAwareProxyProjectionFactory
|
||||
* @since 1.10
|
||||
*/
|
||||
@@ -55,7 +56,7 @@ class ProxyProjectionFactory implements ProjectionFactory, ResourceLoaderAware,
|
||||
*/
|
||||
protected ProxyProjectionFactory() {
|
||||
|
||||
this.factories = new ArrayList<MethodInterceptorFactory>();
|
||||
this.factories = new ArrayList<>();
|
||||
this.factories.add(MapAccessingMethodInterceptorFactory.INSTANCE);
|
||||
this.factories.add(PropertyAccessingMethodInvokerFactory.INSTANCE);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
*/
|
||||
public class SpelAwareProxyProjectionFactory extends ProxyProjectionFactory implements BeanFactoryAware {
|
||||
|
||||
private final Map<Class<?>, Boolean> typeCache = new HashMap<Class<?>, Boolean>();
|
||||
private final Map<Class<?>, Boolean> typeCache = new HashMap<>();
|
||||
private final SpelExpressionParser parser = new SpelExpressionParser();
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2017 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,6 +41,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
* @author Christoph Strobl
|
||||
* @see 1.10
|
||||
*/
|
||||
class SpelEvaluatingMethodInterceptor implements MethodInterceptor {
|
||||
@@ -98,7 +99,7 @@ class SpelEvaluatingMethodInterceptor implements MethodInterceptor {
|
||||
private static Map<Integer, Expression> potentiallyCreateExpressionsForMethodsOnTargetInterface(
|
||||
SpelExpressionParser parser, Class<?> targetInterface) {
|
||||
|
||||
Map<Integer, Expression> expressions = new HashMap<Integer, Expression>();
|
||||
Map<Integer, Expression> expressions = new HashMap<>();
|
||||
|
||||
for (Method method : targetInterface.getMethods()) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user