import javax.ws.rs.core.Response;
class A{
@JsonProperty("B")
List<B> b;
@JsonProperty("abc")
String abc;
}
public abstract class B{
@JsonProperty("def")
String def;
}
public class C extends B{
@JsonProperty("xyz")
String xyz;
}
json:
{
"B": [
{
"def": "<text1>"
},
{
"def": "<text1>",
"xyz": "<text2>"
}
],
"abc": "<text3>"
}
Ответ содержит более 100 * *
A a = response.readEntity(A.class);
Ошибка:
javax.ws.rs.client.ResponseProcessingException:` Problem with reading the data, class A, ContentType: application/json.
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of B: abstract types either need to be mapped
Есть ли Как мы можем создать экземпляр класса, который содержит объект абстрактного класса?