Browse Source

Add @Nullable in doSetValue() in Argument[Type]PreparedStatementSetter

This commit adds @Nullable to the argValue parameters in the
doSetValue() methods in ArgumentPreparedStatementSetter and
ArgumentTypePreparedStatementSetter.

Closes gh-31086
pull/31496/head
Sam Brannen 1 year ago
parent
commit
229b4782ee
  1. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentPreparedStatementSetter.java
  2. 2
      spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentTypePreparedStatementSetter.java

4
spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentPreparedStatementSetter.java

@ -62,7 +62,9 @@ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter, @@ -62,7 +62,9 @@ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter,
* @param argValue the value to set
* @throws SQLException if thrown by PreparedStatement methods
*/
protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException {
protected void doSetValue(PreparedStatement ps, int parameterPosition, @Nullable Object argValue)
throws SQLException {
if (argValue instanceof SqlParameterValue paramValue) {
StatementCreatorUtils.setParameterValue(ps, parameterPosition, paramValue, paramValue.getValue());
}

2
spring-jdbc/src/main/java/org/springframework/jdbc/core/ArgumentTypePreparedStatementSetter.java

@ -94,7 +94,7 @@ public class ArgumentTypePreparedStatementSetter implements PreparedStatementSet @@ -94,7 +94,7 @@ public class ArgumentTypePreparedStatementSetter implements PreparedStatementSet
* @param argValue the argument value
* @throws SQLException if thrown by PreparedStatement methods
*/
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, Object argValue)
protected void doSetValue(PreparedStatement ps, int parameterPosition, int argType, @Nullable Object argValue)
throws SQLException {
StatementCreatorUtils.setParameterValue(ps, parameterPosition, argType, argValue);

Loading…
Cancel
Save