Hullaballoonatic
06/13/2019, 9:38 PMfun <F: Foo> foo1(fooRef: KProperty1<Bar, Foo>) = ...
fun <F: Foo> foo2(foo: Foo) = foo1(WHAT GOES HERE?)
Is there a simple way to do this? Bar::(something with foo)
?karelpeeters
06/13/2019, 10:23 PMfoo1
takes a property of Bar
with type Foo
, and all you've got is an instance or Foo
. How could that possibly converted to the latter?Hullaballoonatic
06/13/2019, 10:27 PMfooRef: KProperty1<Bar, String>
, e.g. Bar::name
. How could you engineer KProperty1<Bar, String>
from name
?karelpeeters
06/13/2019, 10:31 PMclass Bar(val name: String)
and then I do foo2(bar.name)
there's no connection to bar
anymore, bar.name
is just an ordinary String
instance out there with everything elsefoo("test")
, it may be a "property" of multiple classes, it may be in a list somewhere, ...Hullaballoonatic
06/13/2019, 10:32 PMBar
part yourself again.karelpeeters
06/13/2019, 10:33 PM