Browse Source

DATAJDBC-431 - Polishing.

Improved and corrected nullability annotations. Fixed broken Javadoc.

Original pull request: #175.
pull/169/head
Jens Schauder 6 years ago committed by Mark Paluch
parent
commit
3e4e874aa8
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 1
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DataAccessStrategy.java
  2. 4
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategy.java
  3. 2
      spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/HsqlDbOnly.java

1
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DataAccessStrategy.java

@ -58,6 +58,7 @@ public interface DataAccessStrategy extends RelationResolver { @@ -58,6 +58,7 @@ public interface DataAccessStrategy extends RelationResolver {
* @return the id generated by the database if any.
* @since 1.1
*/
@Nullable
default <T> Object insert(T instance, Class<T> domainType, Identifier identifier) {
return insert(instance, domainType, identifier.toMap());
}

4
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategy.java

@ -313,7 +313,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { @@ -313,7 +313,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
return result;
}
private <S, T> MapSqlParameterSource getParameterSource(S instance, RelationalPersistentEntity<S> persistentEntity,
private <S, T> MapSqlParameterSource getParameterSource(@Nullable S instance, RelationalPersistentEntity<S> persistentEntity,
String prefix, Predicate<RelationalPersistentProperty> skipProperty) {
MapSqlParameterSource parameters = new MapSqlParameterSource();
@ -418,7 +418,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { @@ -418,7 +418,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
}
private void addConvertedPropertyValue(MapSqlParameterSource parameterSource, RelationalPersistentProperty property,
Object value, String paramName) {
@Nullable Object value, String paramName) {
JdbcValue jdbcValue = converter.writeJdbcValue( //
value, //

2
spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/HsqlDbOnly.java

@ -27,7 +27,7 @@ import java.lang.annotation.Target; @@ -27,7 +27,7 @@ import java.lang.annotation.Target;
/**
* Run the annotated test only against a HsqlDb database.
*
* Requires the use of
* Requires the use of {@code @ProfileValueSourceConfiguration(DatabaseProfileValueSource.class)} on the test.
*
* @author Jens Schauder
*/

Loading…
Cancel
Save