I'm receiving next json from FE:
{
"type1":"A",
"type2":"B"
}
enum Type1 {
A,
B
}
enum Type2 {
A,
B
}
And base on those two fields I want to map json to specific class. For example I have:
class Base {
Type1 type1;
Type2 type2;
}
class Ab extends Base {
}
Object should be Ab
in case of type1 = A and type2 = B
class Ba extends Base {
}
Object should be Ba
in case of type1 = B and type2 = a
For this case we have @JsonTypeInfo
annotation but it works only with one field. Is there any solution for this problem?