Typefactory class at jackson has many deprecated methods inside it. I am using it like that:
public List<T> getX(Class<T> clz) {
ObjectMapper mapper = new ObjectMapper();
try {
String jsonData = mapper.writeValueAsString(data);
a = mapper.readValue(jsonData, TypeFactory.collectionType(List.class, clz));
} catch (Exception e) {
System.out.println(e.getMessage());
}
return a;// a is a global variable
}
and it warns me that collectionType
is deprecated. What to use instead of it?