I've just moved over to using Java generics, so I'm not sure if I'm even asking the right question.
I am trying to make use of the following method:
public <T> ResponseEntity<T> exchange(String url,
                                  HttpMethod method,
                                  HttpEntity<?> requestEntity,
                                  Class<T> responseType,
                                  Object... uriVariables)
                           throws RestClientException
For type <T> I have provided Response<MyDTO>, so my method call looks like:
ResponseEntity<Response<MyDTO>> re = exchange(...)
I cannot work out how to provide the correct value to the Class<T> responseType parameter?
I do know that generics in java undergo type erasure so you shouldn't be able to determine types at runtime via reflection, but I know the exact type I want to provide.
I have seen many variations of How to get a class instance of generics type T that talk about passing the class type as a constructor parameter.
But I cannot work out how to make an instance of Class<Response<MyDTO>>.
Is there a way to do this? Or is there a restriction in generics that prohibits this?
 
     
     
     
    