Secondary constructor initiation logic
I have a generic data class like:
data class ConfigurationDTO(
val id: Long,
val key: String,
var value: T
)
And I would like to have a constructor where I could pass the value as String and a KClass to deserialize it. The problem is Kotlin oblies me to call this() on the secondary constructor and I have no value for value yet:
constructor(id: Long, key: String, valueStr: String, klazz: KClass)
: this(id, key, ??????)
What I would like to do is the equivalent like:...