Joan Colmenero
03/12/2020, 10:52 AMreturn when {
pojo.dog != null -> {
mapDog(this, pojo = pojo.dog!!)
}
<http://pojo.cat|pojo.cat> != null -> {
mapCat(this, pojo = <http://pojo.cat|pojo.cat>!!)
}
else -> {
mapDefault(this)
}
}
I have to add the !!
because otherwise is saying
Smart cast is impossible because pojo.cat is an API class that is on a different module
darkmoon_uk
03/12/2020, 12:07 PMreturn
pojo.dog?.let { mapDog(this,it) } ?:
<http://pojo.cat?.let|pojo.cat?.let> { mapCat(this,it) } ?:
mapDefault(this)
Joan Colmenero
03/12/2020, 12:27 PMdarkmoon_uk
03/12/2020, 12:40 PMMichael de Kaste
03/12/2020, 12:43 PMMilan Hruban
03/12/2020, 1:01 PMdarkmoon_uk
03/12/2020, 1:06 PMdarkmoon_uk
03/12/2020, 1:07 PMJoan Colmenero
03/12/2020, 1:11 PMdarkmoon_uk
03/12/2020, 1:15 PMMichael de Kaste
03/12/2020, 1:21 PMMichael de Kaste
03/12/2020, 1:21 PMval pojoDog = pojo.dog
Joan Colmenero
03/12/2020, 1:21 PMKroppeb
03/12/2020, 1:49 PMpojo.dog?.let { return mapDog(this,it) }
<http://pojo.cat?.let|pojo.cat?.let> { return mapCat(this,it) }
return mapDefault(this)