ralf
01/11/2017, 6:07 PMapply plugin: ‘kotlin-kapt’
? I noticed that AutoValue doesn’t work, if I apply the plugin. Without applying it it seems to work.rwachol
01/11/2017, 6:22 PMralf
01/11/2017, 6:29 PMrwachol
01/11/2017, 6:52 PMazabost
01/12/2017, 8:58 AMazabost
01/12/2017, 8:59 AMgrandstaish
01/12/2017, 9:03 AMazabost
01/12/2017, 9:04 AMmglukhikh
01/12/2017, 9:05 AMyan
01/12/2017, 9:08 AMazabost
01/12/2017, 9:26 AMorangy
pawel_byszewski
01/12/2017, 1:34 PMjatin
01/12/2017, 2:40 PMjatin
01/12/2017, 2:41 PMjdbc.query(sql, params, (rs, rowNum) -> {
Set<String> labels = new LinkedHashSet<>();
System.out.println("Row Number: " + rowNum);
while (rs.next()) {
String label = rs.getString("label");
labels.add(label);
}
return labels;
});
jatin
01/12/2017, 2:42 PMjdbc.query(sql, params) { rs, rowNum ->
println("Row number: $rowNum")
rs.getString("label")
}.toSet()
jatin
01/12/2017, 2:42 PMrs
iterable? Because I don't need a while loop in the Kotlin version of codeorangy
rs
is not an iterable, it’s a database cursorrocketraman
01/12/2017, 2:44 PMquery
method? It probably calls the lambda with the rs
cursor set to each row in turn.rocketraman
01/12/2017, 2:45 PMjatin
01/12/2017, 2:46 PMquery
method: <T> List<T> query(String sql, Map<String, ?> paramMap, RowMapper<T> rowMapper)
jatin
01/12/2017, 2:46 PMrs
is a cursorjatin
01/12/2017, 2:47 PMrs
rocketraman
01/12/2017, 2:48 PMRowMapper
jatin
01/12/2017, 2:49 PMrocketraman
01/12/2017, 2:49 PMrocketraman
01/12/2017, 2:50 PMRowMapper
? If so, the rs
is already initialized to the current row by Spring, and the lambda should return the mapping to your object for that row only.jatin
01/12/2017, 2:51 PMpublic interface RowMapper<T> {
/**
* Implementations must implement this method to map each row of data
* in the ResultSet. This method should not call {@code next()} on
* the ResultSet; it is only supposed to map values of the current row.
* @param rs the ResultSet to map (pre-initialized for the current row)
* @param rowNum the number of the current row
* @return the result object for the current row
* @throws SQLException if a SQLException is encountered getting
* column values (that is, there's no need to catch SQLException)
*/
T mapRow(ResultSet rs, int rowNum) throws SQLException;
}
jatin
01/12/2017, 2:51 PMjatin
01/12/2017, 2:51 PM