I have an Abstract base class A, and 2 subclasses (B and C) inherit from A.
Now I am currently using RestTemplate exchange to retrieve a list of objects from a REST API endpoint. But those objects can be either B or C. How do I do this using RestTemplate? The following if my code
ResponseEntity<B> response = restTemplate.exchange(
endpointURL,
HttpMethod.GET,
request,
new ParameterizedTypeReference<B>() {} );
Above is for B, but the responseEntity can be either B or C.