DATAJDBC-384 - Polishing.

Update nullable annotations.

Original Pull Request: #157
This commit is contained in:
Christoph Strobl
2019-06-13 13:09:51 +02:00
parent bd03ef83d6
commit b65f866fd5
11 changed files with 23 additions and 17 deletions

View File

@@ -505,7 +505,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
}
@Override
public void setProperty(PersistentProperty<?> property, Object value) {
public void setProperty(PersistentProperty<?> property, @Nullable Object value) {
throw new UnsupportedOperationException("Cannot set value on 'null' target object.");
}

View File

@@ -0,0 +1,2 @@
@org.springframework.lang.NonNullApi
package org.springframework.data.jdbc.core.mapping;

View File

@@ -27,16 +27,17 @@ import org.springframework.lang.Nullable;
* the kind of values available on invocation.
*
* @author Jens Schauder
* @author Christoph Strobl
*/
public class MyBatisContext {
private final Object id;
private final Object instance;
private final Identifier identifier;
private final Class domainType;
private final @Nullable Object id;
private final @Nullable Object instance;
private final @Nullable Identifier identifier;
private final @Nullable Class domainType;
private final Map<String, Object> additonalValues;
public MyBatisContext(@Nullable Object id, @Nullable Object instance, Class domainType,
public MyBatisContext(@Nullable Object id, @Nullable Object instance, @Nullable Class domainType,
Map<String, Object> additonalValues) {
this.id = id;
@@ -46,7 +47,7 @@ public class MyBatisContext {
this.additonalValues = additonalValues;
}
public MyBatisContext(Identifier identifier, Object instance, Class<?> domainType) {
public MyBatisContext(Identifier identifier, @Nullable Object instance, @Nullable Class<?> domainType) {
this.id = null;
this.identifier = identifier;
@@ -70,6 +71,7 @@ public class MyBatisContext {
*
* @return Might return {@literal null}.
*/
@Nullable
public Identifier getIdentifier() {
return identifier;
}

View File

@@ -259,7 +259,8 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy {
new MyBatisContext(identifier, null, path.getRequiredLeafProperty().getType()));
} catch (PersistenceException pex) {
LOG.debug("Didn't find %s in the MyBatis session. Falling back to findAllByPath", pex);
LOG.debug(String.format("Didn't find %s in the MyBatis session. Falling back to findAllByPath.", statementName),
pex);
return DataAccessStrategy.super.findAllByPath(identifier, path);
}

View File

@@ -30,7 +30,7 @@ abstract class AbstractImportValidator implements Visitor {
Set<Table> requiredByWhere = new HashSet<>();
Set<Table> from = new HashSet<>();
Visitable parent;
@Nullable Visitable parent;
/*
* (non-Javadoc)

View File

@@ -46,7 +46,6 @@ public class BindMarker extends AbstractSegment implements Expression {
* (non-Javadoc)
* @see org.springframework.data.relational.core.sql.Named#getName()
*/
@Nullable
@Override
public String getName() {
return name;

View File

@@ -26,7 +26,7 @@ import org.springframework.util.Assert;
*/
class DefaultDeleteBuilder implements DeleteBuilder, DeleteBuilder.DeleteWhereAndOr, DeleteBuilder.DeleteWhere {
private Table from;
private @Nullable Table from;
private @Nullable Condition where;
/*

View File

@@ -20,6 +20,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -31,7 +32,7 @@ import org.springframework.util.Assert;
class DefaultInsertBuilder
implements InsertBuilder, InsertBuilder.InsertIntoColumnsAndValuesWithBuild, InsertBuilder.InsertValuesWithBuild {
private Table into;
private @Nullable Table into;
private List<Column> columns = new ArrayList<>();
private List<Expression> values = new ArrayList<>();

View File

@@ -284,15 +284,15 @@ class DefaultSelectBuilder implements SelectBuilder, SelectAndFrom, SelectFromAn
private final Table table;
private final DefaultSelectBuilder selectBuilder;
private final JoinType joinType;
private Expression from;
private Expression to;
private @Nullable Expression from;
private @Nullable Expression to;
private @Nullable Condition condition;
JoinBuilder(Table table, DefaultSelectBuilder selectBuilder, JoinType joinType) {
this.table = table;
this.selectBuilder = selectBuilder;
this.joinType = joinType;
}

View File

@@ -34,7 +34,7 @@ import org.springframework.util.Assert;
*/
class DefaultUpdateBuilder implements UpdateBuilder, UpdateWhere, UpdateWhereAndOr, UpdateAssign {
private Table table;
private @Nullable Table table;
private List<Assignment> assignments = new ArrayList<>();
private @Nullable Condition where;

View File

@@ -20,6 +20,7 @@ import java.util.function.Predicate;
import org.springframework.data.relational.core.sql.Condition;
import org.springframework.data.relational.core.sql.Expression;
import org.springframework.data.relational.core.sql.Visitable;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
/**
@@ -32,7 +33,7 @@ import org.springframework.util.Assert;
abstract class FilteredSingleConditionRenderSupport extends FilteredSubtreeVisitor {
private final RenderContext context;
private PartRenderer current;
private @Nullable PartRenderer current;
/**
* Creates a new {@link FilteredSingleConditionRenderSupport} given the filter {@link Predicate}.