Skip to content

Commit d8aa3e4

Browse files
committed
Switch to tabs, and adjust tabsizing in asciidoctor.
1 parent 8a62b7a commit d8aa3e4

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ the following listing (from
6161
`src/main/java/com/example/relationaldataaccess/Customer.java`) shows:
6262

6363
====
64-
[source,java]
64+
[source,java,tabsize=2]
6565
----
6666
include::complete/src/main/java/com/example/relationaldataaccess/Customer.java[]
6767
----
@@ -78,7 +78,7 @@ All you have to do is focus on the task at hand. The following listing (from
7878
shows a class that can store and retrieve data over JDBC:
7979

8080
====
81-
[source,java]
81+
[source,java,tabsize=2]
8282
----
8383
include::complete/src/main/java/com/example/relationaldataaccess/RelationalDataAccessApplication.java[]
8484
----
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package com.example.relationaldataaccess;
22

33
public class Customer {
4-
private long id;
5-
private String firstName, lastName;
4+
private long id;
5+
private String firstName, lastName;
66

7-
public Customer(long id, String firstName, String lastName) {
8-
this.id = id;
9-
this.firstName = firstName;
10-
this.lastName = lastName;
11-
}
7+
public Customer(long id, String firstName, String lastName) {
8+
this.id = id;
9+
this.firstName = firstName;
10+
this.lastName = lastName;
11+
}
1212

13-
@Override
14-
public String toString() {
15-
return String.format(
16-
"Customer[id=%d, firstName='%s', lastName='%s']",
17-
id, firstName, lastName);
18-
}
13+
@Override
14+
public String toString() {
15+
return String.format(
16+
"Customer[id=%d, firstName='%s', lastName='%s']",
17+
id, firstName, lastName);
18+
}
1919

20-
// getters & setters omitted for brevity
20+
// getters & setters omitted for brevity
2121
}

complete/src/main/java/com/example/relationaldataaccess/RelationalDataAccessApplication.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,39 @@
1515
@SpringBootApplication
1616
public class RelationalDataAccessApplication implements CommandLineRunner {
1717

18-
private static final Logger log = LoggerFactory.getLogger(RelationalDataAccessApplication.class);
18+
private static final Logger log = LoggerFactory.getLogger(RelationalDataAccessApplication.class);
1919

20-
public static void main(String args[]) {
21-
SpringApplication.run(RelationalDataAccessApplication.class, args);
22-
}
20+
public static void main(String args[]) {
21+
SpringApplication.run(RelationalDataAccessApplication.class, args);
22+
}
2323

24-
@Autowired
25-
JdbcTemplate jdbcTemplate;
24+
@Autowired
25+
JdbcTemplate jdbcTemplate;
2626

27-
@Override
28-
public void run(String... strings) throws Exception {
27+
@Override
28+
public void run(String... strings) throws Exception {
2929

30-
log.info("Creating tables");
30+
log.info("Creating tables");
3131

32-
jdbcTemplate.execute("DROP TABLE customers IF EXISTS");
33-
jdbcTemplate.execute("CREATE TABLE customers(" +
34-
"id SERIAL, first_name VARCHAR(255), last_name VARCHAR(255))");
32+
jdbcTemplate.execute("DROP TABLE customers IF EXISTS");
33+
jdbcTemplate.execute("CREATE TABLE customers(" +
34+
"id SERIAL, first_name VARCHAR(255), last_name VARCHAR(255))");
3535

36-
// Split up the array of whole names into an array of first/last names
37-
List<Object[]> splitUpNames = Arrays.asList("John Woo", "Jeff Dean", "Josh Bloch", "Josh Long").stream()
38-
.map(name -> name.split(" "))
39-
.collect(Collectors.toList());
36+
// Split up the array of whole names into an array of first/last names
37+
List<Object[]> splitUpNames = Arrays.asList("John Woo", "Jeff Dean", "Josh Bloch", "Josh Long").stream()
38+
.map(name -> name.split(" "))
39+
.collect(Collectors.toList());
4040

41-
// Use a Java 8 stream to print out each tuple of the list
42-
splitUpNames.forEach(name -> log.info(String.format("Inserting customer record for %s %s", name[0], name[1])));
41+
// Use a Java 8 stream to print out each tuple of the list
42+
splitUpNames.forEach(name -> log.info(String.format("Inserting customer record for %s %s", name[0], name[1])));
4343

44-
// Uses JdbcTemplate's batchUpdate operation to bulk load data
45-
jdbcTemplate.batchUpdate("INSERT INTO customers(first_name, last_name) VALUES (?,?)", splitUpNames);
44+
// Uses JdbcTemplate's batchUpdate operation to bulk load data
45+
jdbcTemplate.batchUpdate("INSERT INTO customers(first_name, last_name) VALUES (?,?)", splitUpNames);
4646

47-
log.info("Querying for customer records where first_name = 'Josh':");
48-
jdbcTemplate.query(
49-
"SELECT id, first_name, last_name FROM customers WHERE first_name = ?", new Object[] { "Josh" },
50-
(rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name"))
51-
).forEach(customer -> log.info(customer.toString()));
52-
}
47+
log.info("Querying for customer records where first_name = 'Josh':");
48+
jdbcTemplate.query(
49+
"SELECT id, first_name, last_name FROM customers WHERE first_name = ?", new Object[] { "Josh" },
50+
(rs, rowNum) -> new Customer(rs.getLong("id"), rs.getString("first_name"), rs.getString("last_name"))
51+
).forEach(customer -> log.info(customer.toString()));
52+
}
5353
}

0 commit comments

Comments
 (0)