Introduce OutboundRow.clone() method.

Closes #620.
This commit is contained in:
Mark Paluch
2021-07-13 10:10:25 +02:00
parent e0d6130ac8
commit 8ef6fa416d

View File

@@ -36,7 +36,7 @@ import org.springframework.util.Assert;
* @see SqlIdentifier
* @see Parameter
*/
public class OutboundRow implements Map<SqlIdentifier, Parameter> {
public class OutboundRow implements Map<SqlIdentifier, Parameter>, Cloneable {
private final Map<SqlIdentifier, Parameter> rowAsMap;
@@ -61,6 +61,12 @@ public class OutboundRow implements Map<SqlIdentifier, Parameter> {
map.forEach((s, Parameter) -> this.rowAsMap.put(SqlIdentifier.unquoted(s), Parameter));
}
private OutboundRow(OutboundRow map) {
this.rowAsMap = new LinkedHashMap<>(map.size());
this.rowAsMap.putAll(map);
}
/**
* Create a {@link OutboundRow} instance initialized with the given key/value pair.
*
@@ -137,6 +143,15 @@ public class OutboundRow implements Map<SqlIdentifier, Parameter> {
return this.rowAsMap.isEmpty();
}
/*
* (non-Javadoc)
* @see java.lang.Object#clone()
*/
@Override
protected OutboundRow clone() {
return new OutboundRow(this);
}
/*
* (non-Javadoc)
* @see java.util.Map#containsKey(java.lang.Object)