Jonathan Hollingsworth
10/07/2021, 3:28 AMval components: List<Component> = BuilderClass(...some stuff...).into(Component)
I.e. you use the into
function to take any Class and return a list of that class
Something like
Class BuilderClass(...) {
fun into(klass: KClass<Any>): List<what_goes_here?> {
...
Anyone know if this is possible?Paul Griffith
10/07/2021, 3:36 AMfun <T : Any> into(klass: KClass<T>): List<T> {
?inline fun <reified T : Any> into(): List<T> {
, which would be called something like into<Component>()
Jonathan Hollingsworth
10/07/2021, 3:38 AMinto()
in order to map a returned sql result set onto properties, so I’m guessing I’ll need the class as an argument in the func?BuilderClass(...).into<Component>(Component::class)
Tobias Suchalla
10/07/2021, 6:00 AMreified
approach from above, you don't need the explicit class parameter. You can just use T::class
in your function body since the type is no longer erased.Jonathan Hollingsworth
10/07/2021, 6:45 AMreified
then.
Thank you