I have the following function that should map from one data class to another but it is not working:
private fun ClassA.toClassB() = ClassB(
text = text,
meta = meta,
message = message)
ClassB is underlined in red with the error None of the following functions can be called with the arguments supplied.
However, just mapping the attribute text works fine:
private fun ClassA.toClassB() = ClassB(
text = text)
So I guess the upper code doesn't work because of the enum attributes.
ClassA and ClassB look exactly the same, like this:
data class ClassB(
@JsonProperty("text")
val text: String,
@JsonProperty("meta")
val meta: Meta?,
@JsonProperty("message")
val message: Message?,
) {
constructor(text: String) : this(
text = text,
meta = null,
message = null,
)
enum class Meta {
ONE, TWO, THREE
}
enum class Message {
ONE, TWO
}}
So how can I map data classes that use enum attributes?