Below is the class structure:
Response.java
@Getter
@Setter
public class Response implements Serializable{
private final static long serialVersionUID = 8875657894025733696L;
@JsonProperty ("status")
public String status;
@JsonProperty("payload")
public Payload payload;
}
Payload.java
@Getter
@Setter
public class Payload<T> implements Serializable {
private final static long serialVersionUID = 1732258949055126977L;
@JsonProperty ("data")
public List <T> data;
}
Here T is generic class
Response response = restTemplate.postForObject(url, request, Response.class);
What could be JavaType or TypeReference to replace Response.class in the above statement, so that I can directly get a List of T by response.getPayload().getData();? Currently it is coming as LinkedHashMap.