I have a model like that:
Code:
public class Wrapper<T> {
private String message;
private T data;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
and I use resttemplate as follows:
Code:
...
Wrapper<Model> response = restTemplate.getForObject(URL, Wrapper.class, myMap);
Model model = response.getData();
...
However it throws a:
I think resttemplate can not understand my generic variable and maybe it accepts it as an Object instead of generic T. So it becomes a LinkedHashMap. You can read from it at here It says that when explaining from what it marshalls to:
JSON Type | Java Type
object | LinkedHashMap
PS: I have a question here: http://stackoverflow.com/questions/8...g-resttemplate