title: Uniformly delegated properties in kotlin
body: <p>When you have a backing object that you would like to wrap and delegate all properties with the same delegate logic, is there some way to generically describe a class implementation with all the properties delegated the same way? Take the example below:</p>
  <pre><code>class Subject&lt;T, U&gt;(
      private val prop : KMutableProperty0&lt;U&gt;
  ) {
      operator fun getValue(caller: T, prop: KProperty&lt;*&gt;) : U = this.prop.get()
      operator fun setValue(caller: T, prop: KProperty&lt;*&gt;, value : U) {
          // dostuff
          this.prop.set(value)
      }
  }
  
  interface Test {
      val prop1 : String
      val prop2 : String
  }
  
  @Serializable
  class TestImpl(
      override var prop1: String,
      override var prop2: String
  ) : Test
  
  
  // I don't want to have to write this boilerplate every time I need to delegate logic from a serializeable data object
  class Wrapper( val test : TestImpl) : Test {
      override var prop1 by Subject(testImpl::prop1)
      override var prop2 by Subject(testImpl::prop2)
  }
  </code></pre>
  <p>Is there any language feature that would let me write something like this:</p>
  <pre><code>class GenericWrapper&lt;T , U : T&gt;(val impl : U) : T /* can't do this obviously */{
      // for each property on T, overwrite the property and delegate accordingly
  }
  </code></pre>
  <p>The only thing I can think of at this point is writing my own compiler plugin, but is this the only option?</p>