Skip to content

Commit b65f866

Browse files
DATAJDBC-384 - Polishing.
Update nullable annotations. Original Pull Request: #157
1 parent bd03ef8 commit b65f866

File tree

11 files changed

+23
-17
lines changed

11 files changed

+23
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ static <T> NoValuePropertyAccessor<T> instance() {
505505
}
506506

507507
@Override
508-
public void setProperty(PersistentProperty<?> property, Object value) {
508+
public void setProperty(PersistentProperty<?> property, @Nullable Object value) {
509509
throw new UnsupportedOperationException("Cannot set value on 'null' target object.");
510510
}
511511

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@org.springframework.lang.NonNullApi
2+
package org.springframework.data.jdbc.core.mapping;

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisContext.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
* the kind of values available on invocation.
2828
*
2929
* @author Jens Schauder
30+
* @author Christoph Strobl
3031
*/
3132
public class MyBatisContext {
3233

33-
private final Object id;
34-
private final Object instance;
35-
private final Identifier identifier;
36-
private final Class domainType;
34+
private final @Nullable Object id;
35+
private final @Nullable Object instance;
36+
private final @Nullable Identifier identifier;
37+
private final @Nullable Class domainType;
3738
private final Map<String, Object> additonalValues;
3839

39-
public MyBatisContext(@Nullable Object id, @Nullable Object instance, Class domainType,
40+
public MyBatisContext(@Nullable Object id, @Nullable Object instance, @Nullable Class domainType,
4041
Map<String, Object> additonalValues) {
4142

4243
this.id = id;
@@ -46,7 +47,7 @@ public MyBatisContext(@Nullable Object id, @Nullable Object instance, Class doma
4647
this.additonalValues = additonalValues;
4748
}
4849

49-
public MyBatisContext(Identifier identifier, Object instance, Class<?> domainType) {
50+
public MyBatisContext(Identifier identifier, @Nullable Object instance, @Nullable Class<?> domainType) {
5051

5152
this.id = null;
5253
this.identifier = identifier;
@@ -70,6 +71,7 @@ public Object getId() {
7071
*
7172
* @return Might return {@literal null}.
7273
*/
74+
@Nullable
7375
public Identifier getIdentifier() {
7476
return identifier;
7577
}

spring-data-jdbc/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ public Iterable<Object> findAllByPath(Identifier identifier,
259259
new MyBatisContext(identifier, null, path.getRequiredLeafProperty().getType()));
260260
} catch (PersistenceException pex) {
261261

262-
LOG.debug("Didn't find %s in the MyBatis session. Falling back to findAllByPath", pex);
262+
LOG.debug(String.format("Didn't find %s in the MyBatis session. Falling back to findAllByPath.", statementName),
263+
pex);
263264

264265
return DataAccessStrategy.super.findAllByPath(identifier, path);
265266
}

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/AbstractImportValidator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract class AbstractImportValidator implements Visitor {
3030

3131
Set<Table> requiredByWhere = new HashSet<>();
3232
Set<Table> from = new HashSet<>();
33-
Visitable parent;
33+
@Nullable Visitable parent;
3434

3535
/*
3636
* (non-Javadoc)

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/BindMarker.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ static class NamedBindMarker extends BindMarker implements Named {
4646
* (non-Javadoc)
4747
* @see org.springframework.data.relational.core.sql.Named#getName()
4848
*/
49-
@Nullable
5049
@Override
5150
public String getName() {
5251
return name;

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultDeleteBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
class DefaultDeleteBuilder implements DeleteBuilder, DeleteBuilder.DeleteWhereAndOr, DeleteBuilder.DeleteWhere {
2828

29-
private Table from;
29+
private @Nullable Table from;
3030
private @Nullable Condition where;
3131

3232
/*

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultInsertBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import java.util.Collection;
2121
import java.util.List;
2222

23+
import org.springframework.lang.Nullable;
2324
import org.springframework.util.Assert;
2425

2526
/**
@@ -31,7 +32,7 @@
3132
class DefaultInsertBuilder
3233
implements InsertBuilder, InsertBuilder.InsertIntoColumnsAndValuesWithBuild, InsertBuilder.InsertValuesWithBuild {
3334

34-
private Table into;
35+
private @Nullable Table into;
3536
private List<Column> columns = new ArrayList<>();
3637
private List<Expression> values = new ArrayList<>();
3738

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultSelectBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,15 @@ static class JoinBuilder implements SelectOn, SelectOnConditionComparison, Selec
284284
private final Table table;
285285
private final DefaultSelectBuilder selectBuilder;
286286
private final JoinType joinType;
287-
private Expression from;
288-
private Expression to;
287+
private @Nullable Expression from;
288+
private @Nullable Expression to;
289289
private @Nullable Condition condition;
290290

291291

292292
JoinBuilder(Table table, DefaultSelectBuilder selectBuilder, JoinType joinType) {
293+
293294
this.table = table;
294295
this.selectBuilder = selectBuilder;
295-
296296
this.joinType = joinType;
297297
}
298298

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultUpdateBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535
class DefaultUpdateBuilder implements UpdateBuilder, UpdateWhere, UpdateWhereAndOr, UpdateAssign {
3636

37-
private Table table;
37+
private @Nullable Table table;
3838
private List<Assignment> assignments = new ArrayList<>();
3939
private @Nullable Condition where;
4040

0 commit comments

Comments
 (0)