title: Access Kotlin Interface/Class property by string key?
body: <p>I need to access a class instance property similar to accessing a map in Kotlin.</p>
  <p>For a map it goes like this</p>
  <pre><code>val myMap: Map&lt;String, String&gt; = mapOf(&quot;foo&quot; to &quot;bar&quot;)
  assertThat(myMap[&quot;foo&quot;]).isEqualTo(&quot;bar&quot;
  </code></pre>
  <p>Now I want something similar to a class</p>
  <pre><code>data class House(
    val street: String
  )
  
  // pseudo code wish
  fun foo() {
    val valueOfFoo: String = House::class.members[&quot;foo&quot;].callGet()
  }
  </code></pre>
  <p>I read into reflection but can't find a way to call it. I know the problem somewhat is that there is no class instance passed or specified. However I wonder if there is such thing?</p>
  <pre><code>val house = House(&quot;Baker Street 5&quot;)
  val valueOfFoo: String = House::class.members[&quot;foo&quot;].callGetWithInstance(house)
     
  assertThat(valueOfFoo).isEqualTo(&quot;Baker Street 5&quot;)
  </code></pre>