Jackson中的Typefactory类中有许多已弃用的方法。我正在这样使用它:
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
}
它警告我说collectionType
已经过时。请问该使用什么替代它?