We have two case classes which has different parameters. For Example -
case class OneType(@JsonProperty("column1") column1 : String,
@JsonProperty("column2") column2 : Map[String,Any],
@JsonProperty("column3") column3 : Seq[String]
)
case class AnotherType(@JsonProperty("column1") column1 : String,
@JsonProperty("column2") column2 : BigInt,
@JsonProperty("column3") column3 : Map[String,String]
)
These two case classes will be used to de-serialize incoming JSON messages(by mapping them with the case class). They need to be used in another class declaration. For example -
class JSONDeserialize extends StreamManager(String, Either[Failed, OneType/AnotherType]){
}
How to dynamically assign appropriate case class(here either OneType or AnotherType) into JSONDeserialize class without having duplicate JSONDeserialize class?