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);
}