JDBC, JMS, JPA Sonar fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -19,6 +19,7 @@ package org.springframework.integration.jpa.support;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -59,7 +60,7 @@ public class JpaParameter {
|
||||
* @param value If null, the expression property must be set
|
||||
* @param expression If null, the value property must be set
|
||||
*/
|
||||
public JpaParameter(String name, Object value, String expression) {
|
||||
public JpaParameter(String name, @Nullable Object value, @Nullable String expression) {
|
||||
super();
|
||||
|
||||
Assert.hasText(name, "'name' must not be empty.");
|
||||
@@ -76,7 +77,7 @@ public class JpaParameter {
|
||||
* @param value If null, the expression property must be set
|
||||
* @param expression If null, the value property must be set
|
||||
*/
|
||||
public JpaParameter(Object value, String expression) {
|
||||
public JpaParameter(@Nullable Object value, @Nullable String expression) {
|
||||
this.value = value;
|
||||
this.setExpression(expression);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionException;
|
||||
import org.springframework.integration.jpa.support.JpaParameter;
|
||||
import org.springframework.integration.jpa.support.parametersource.ExpressionEvaluatingParameterSourceUtils.ParameterExpressionEvaluator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -55,7 +56,7 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
|
||||
this(null);
|
||||
}
|
||||
|
||||
public ExpressionEvaluatingParameterSourceFactory(BeanFactory beanFactory) {
|
||||
public ExpressionEvaluatingParameterSourceFactory(@Nullable BeanFactory beanFactory) {
|
||||
this.parameters = new ArrayList<>();
|
||||
this.expressionEvaluator.setBeanFactory(beanFactory);
|
||||
}
|
||||
@@ -78,6 +79,7 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionSupportingParameterSource createParameterSource(final Object input) {
|
||||
return new ExpressionEvaluatingParameterSource(input, this.parameters, this.expressionEvaluator);
|
||||
}
|
||||
@@ -109,6 +111,7 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueByPosition(int position) {
|
||||
|
||||
Assert.isTrue(position >= 0, "The position must be non-negative.");
|
||||
@@ -148,6 +151,7 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(String paramName) {
|
||||
if (this.values.containsKey(paramName)) {
|
||||
return this.values.get(paramName);
|
||||
@@ -178,6 +182,7 @@ public class ExpressionEvaluatingParameterSourceFactory implements ParameterSour
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(String paramName) {
|
||||
try {
|
||||
final Object value = getValue(paramName);
|
||||
|
||||
Reference in New Issue
Block a user