Skip to content

Commit 8ef6fa4

Browse files
committed
Introduce OutboundRow.clone() method.
Closes #620.
1 parent e0d6130 commit 8ef6fa4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @see SqlIdentifier
3737
* @see Parameter
3838
*/
39-
public class OutboundRow implements Map<SqlIdentifier, Parameter> {
39+
public class OutboundRow implements Map<SqlIdentifier, Parameter>, Cloneable {
4040

4141
private final Map<SqlIdentifier, Parameter> rowAsMap;
4242

@@ -61,6 +61,12 @@ public OutboundRow(Map<String, Parameter> map) {
6161
map.forEach((s, Parameter) -> this.rowAsMap.put(SqlIdentifier.unquoted(s), Parameter));
6262
}
6363

64+
private OutboundRow(OutboundRow map) {
65+
66+
this.rowAsMap = new LinkedHashMap<>(map.size());
67+
this.rowAsMap.putAll(map);
68+
}
69+
6470
/**
6571
* Create a {@link OutboundRow} instance initialized with the given key/value pair.
6672
*
@@ -137,6 +143,15 @@ public boolean isEmpty() {
137143
return this.rowAsMap.isEmpty();
138144
}
139145

146+
/*
147+
* (non-Javadoc)
148+
* @see java.lang.Object#clone()
149+
*/
150+
@Override
151+
protected OutboundRow clone() {
152+
return new OutboundRow(this);
153+
}
154+
140155
/*
141156
* (non-Javadoc)
142157
* @see java.util.Map#containsKey(java.lang.Object)

0 commit comments

Comments
 (0)