, " 1", , , . , , .
SelectQueryBuilder
( ) , parseList
, MapRowParser<T>
. MapRowParser<T>
parseRow
, Map<String, Any?>
a T
.
Java- MapRowParser<T>
parseRow
, ; Map<String, Any?>
DayForecast
( T
). parseList
. :
class MapToDayForecastRowParser extends MapRowParser<DayForecast> {
@Override public DayForecast parseRow(Map<String, Object> map) {
return new DayForecast(map);
}
}
// . , .. parseList
, Map<String, Any?>
T
( , DayForecast(HashMap(it))
, it
, Map
. parseList
, , . , - , Kotlin .
, , - , .
new MapRowParser<T>() {
@Override public T parseRow(Map<String, Object>) {
}
}
object : MapRowParser<T> {
override fun parseRow(columns: Map<String, Any?>): T = parser(columns)
}
Kotlin "". parser
, parseRow
. , , , , .
Kotlin , , . , , parseList{ it.getOrDefault("name", "unkown_user") }
. " , , ?".