Browse Source

Introduce OutboundRow.clone() method.

Closes #620.
pull/1188/head
Mark Paluch 4 years ago
parent
commit
8ef6fa416d
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 17
      src/main/java/org/springframework/data/r2dbc/mapping/OutboundRow.java

17
src/main/java/org/springframework/data/r2dbc/mapping/OutboundRow.java

@ -36,7 +36,7 @@ import org.springframework.util.Assert; @@ -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> { @@ -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> { @@ -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)

Loading…
Cancel
Save