Browse Source

DATACMNS-1673 - Polishing.

Use method references where possible. Cleanup generics. Omit superfluous calls.

Original pull request: #426.
2.1.x
SergiiTsypanov 6 years ago committed by Mark Paluch
parent
commit
674825d179
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 4
      src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java
  2. 4
      src/main/java/org/springframework/data/repository/core/support/MethodInvocationValidator.java
  3. 4
      src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java

4
src/main/java/org/springframework/data/mapping/model/BasicPersistentEntity.java

@ -278,9 +278,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement @@ -278,9 +278,7 @@ public class BasicPersistentEntity<T, P extends PersistentProperty<P>> implement
Assert.notNull(association, "Association must not be null!");
if (!associations.contains(association)) {
associations.add(association);
}
associations.add(association);
}
/*

4
src/main/java/org/springframework/data/repository/core/support/MethodInvocationValidator.java

@ -111,13 +111,13 @@ public class MethodInvocationValidator implements MethodInterceptor { @@ -111,13 +111,13 @@ public class MethodInvocationValidator implements MethodInterceptor {
boolean nullableReturn;
boolean[] nullableParameters;
MethodParameter methodParameters[];
MethodParameter[] methodParameters;
static Nullability of(Method method, ParameterNameDiscoverer discoverer) {
boolean nullableReturn = isNullableParameter(new MethodParameter(method, -1));
boolean[] nullableParameters = new boolean[method.getParameterCount()];
MethodParameter methodParameters[] = new MethodParameter[method.getParameterCount()];
MethodParameter[] methodParameters = new MethodParameter[method.getParameterCount()];
for (int i = 0; i < method.getParameterCount(); i++) {

4
src/main/java/org/springframework/data/repository/support/ReflectionRepositoryInvoker.java

@ -178,7 +178,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker { @@ -178,7 +178,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
* @see org.springframework.data.rest.core.invoke.RepositoryInvoker#invokeQueryMethod(java.lang.reflect.Method, java.util.Map, org.springframework.data.domain.Pageable, org.springframework.data.domain.Sort)
*/
@Override
public Optional<Object> invokeQueryMethod(Method method, MultiValueMap<String, ? extends Object> parameters,
public Optional<Object> invokeQueryMethod(Method method, MultiValueMap<String, ?> parameters,
Pageable pageable, Sort sort) {
Assert.notNull(method, "Method must not be null!");
@ -191,7 +191,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker { @@ -191,7 +191,7 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
return returnAsOptional(invoke(method, prepareParameters(method, parameters, pageable, sort)));
}
private Object[] prepareParameters(Method method, MultiValueMap<String, ? extends Object> rawParameters,
private Object[] prepareParameters(Method method, MultiValueMap<String, ?> rawParameters,
Pageable pageable, Sort sort) {
List<MethodParameter> parameters = new MethodParameters(method, Optional.of(PARAM_ANNOTATION)).getParameters();

Loading…
Cancel
Save