Skip to content

Commit 57ebe03

Browse files
committed
Convert to record
1 parent ebccaa5 commit 57ebe03

File tree

2 files changed

+2
-26
lines changed

2 files changed

+2
-26
lines changed

src/test/java/examples/spring/CompoundKeyRow.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,4 @@
1515
*/
1616
package examples.spring;
1717

18-
public class CompoundKeyRow {
19-
private Integer id1;
20-
private Integer id2;
21-
22-
public Integer getId1() {
23-
return id1;
24-
}
25-
26-
public void setId1(Integer id1) {
27-
this.id1 = id1;
28-
}
29-
30-
public Integer getId2() {
31-
return id2;
32-
}
33-
34-
public void setId2(Integer id2) {
35-
this.id2 = id2;
36-
}
37-
}
18+
public record CompoundKeyRow (Integer id1, Integer id2) {}

src/test/java/examples/spring/SpringMapToRowTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,5 @@ void testInsertBatch() {
123123
}
124124

125125
static final RowMapper<CompoundKeyRow> rowMapper =
126-
(rs, i) -> {
127-
CompoundKeyRow answer = new CompoundKeyRow();
128-
answer.setId1(rs.getInt("ID1"));
129-
answer.setId2(rs.getInt("ID2"));
130-
return answer;
131-
};
126+
(rs, i) -> new CompoundKeyRow(rs.getInt("ID1"), rs.getInt("ID2"));
132127
}

0 commit comments

Comments
 (0)