Browse Source

DATAJDBC-542 - Polishing.

Initialize map with capacity. Fix generics.

Original pull request: #218.
pull/220/head
Mark Paluch 6 years ago
parent
commit
fc74fa9975
No known key found for this signature in database
GPG Key ID: 51A00FA751B91849
  1. 4
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisContext.java
  2. 8
      spring-data-relational/src/main/java/org/springframework/data/jdbc/core/convert/Identifier.java

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

@ -37,7 +37,7 @@ public class MyBatisContext { @@ -37,7 +37,7 @@ public class MyBatisContext {
private final @Nullable Class domainType;
private final Map<String, Object> additionalValues;
public MyBatisContext(@Nullable Object id, @Nullable Object instance, @Nullable Class domainType,
public MyBatisContext(@Nullable Object id, @Nullable Object instance, @Nullable Class<?> domainType,
Map<String, Object> additionalValues) {
this.id = id;
@ -78,7 +78,7 @@ public class MyBatisContext { @@ -78,7 +78,7 @@ public class MyBatisContext {
/**
* The entity to act upon. This is {@code null} for queries, since the object doesn't exist before the query.
*
*
* @return Might return {@code null}.
*/
@Nullable

8
spring-data-relational/src/main/java/org/springframework/data/jdbc/core/convert/Identifier.java

@ -27,7 +27,6 @@ import java.util.Collections; @@ -27,7 +27,6 @@ import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.util.Assert;
@ -145,7 +144,7 @@ public final class Identifier { @@ -145,7 +144,7 @@ public final class Identifier {
*/
public Map<SqlIdentifier, Object> toMap() {
Map<SqlIdentifier, Object> result = new StringKeyedLinkedHashMap<>();
Map<SqlIdentifier, Object> result = new StringKeyedLinkedHashMap<>(getParts().size());
forEach((name, value, type) -> result.put(name, value));
return result;
}
@ -216,6 +215,10 @@ public final class Identifier { @@ -216,6 +215,10 @@ public final class Identifier {
private static class StringKeyedLinkedHashMap<V> extends LinkedHashMap<SqlIdentifier,V> {
public StringKeyedLinkedHashMap(int initialCapacity) {
super(initialCapacity);
}
@Override
public V get(Object key) {
@ -227,6 +230,7 @@ public final class Identifier { @@ -227,6 +230,7 @@ public final class Identifier {
}
}
}
return super.get(key);
}
}

Loading…
Cancel
Save