DATAJDBC-542 - Polishing.
Initialize map with capacity. Fix generics. Original pull request: #218.
This commit is contained in:
@@ -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 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
@@ -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 {
|
||||
*/
|
||||
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 {
|
||||
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user