Skip to content

Commit 123b36a

Browse files
committed
Polishing
Signed-off-by: Sébastien Deleuze <sdeleuze@users.noreply.github.com>
1 parent fba6bfb commit 123b36a

File tree

4 files changed

+6
-18
lines changed

4 files changed

+6
-18
lines changed

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ NOTE: If your IDE has the Spring Initializr integration, you can complete this p
3636
NOTE: You can also fork the project from GitHub and open it in your IDE or other editor.
3737

3838
[[initial]]
39-
== Create a `Customer` Object
39+
== Create a `Customer` class
4040

4141
The simple data access logic you will work with manages the first and last names of
4242
customers. To represent this data at the application level, create a `Customer` class, as

complete-kotlin/src/main/kotlin/com/example/relationaldataaccess/RelationalDataAccessApplication.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ import org.springframework.boot.runApplication
77
import org.springframework.jdbc.core.JdbcTemplate
88
import org.springframework.jdbc.core.query
99

10+
private val log = LoggerFactory.getLogger(RelationalDataAccessApplication::class.java)
11+
1012
@SpringBootApplication
1113
class RelationalDataAccessApplication(
12-
private val jdbcTemplate: JdbcTemplate
13-
) : CommandLineRunner {
14-
15-
private val log = LoggerFactory.getLogger(RelationalDataAccessApplication::class.java)
14+
private val jdbcTemplate: JdbcTemplate) : CommandLineRunner {
1615

1716
override fun run(vararg args: String) {
1817
log.info("Creating tables")
@@ -25,8 +24,7 @@ class RelationalDataAccessApplication(
2524
first_name VARCHAR(255),
2625
last_name VARCHAR(255)
2726
)
28-
""".trimIndent()
29-
)
27+
""".trimIndent())
3028

3129
// Split up the array of whole names into an array of first/last names
3230
val splitUpNames = listOf("John Woo", "Jeff Dean", "Josh Bloch", "Josh Long")
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
11
package com.example.relationaldataaccess;
22

3-
public class Customer {
4-
private final long id;
5-
private final String firstName, lastName;
6-
7-
public Customer(long id, String firstName, String lastName) {
8-
this.id = id;
9-
this.firstName = firstName;
10-
this.lastName = lastName;
11-
}
3+
public record Customer(long id, String firstName, String lastName) {
124

135
@Override
146
public String toString() {
157
return String.format(
168
"Customer[id=%d, firstName='%s', lastName='%s']",
179
id, firstName, lastName);
1810
}
19-
20-
// getters & setters omitted for brevity
2111
}

test/run.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)