我如何{}在Java中引用。它是新对象,类还是数据类型还是其他?
我正在通过json中的一些代码进行对象转换。它使用com.fasterxml.jackson.core.type.TypeReference。我想了解是什么{}。因为方法总是接受对象。当我这样做时new XXX(),对象的创建就完成了。那么,额外需要什么{}呢?
try {
return objectMapper.readValue(dbData, new TypeReference<List<MyClass>>() {});
} catch (IOException e) {
LOGGER.error("Exception while de-serializing", e);
return Collections.emptyList();
}
Run Code Online (Sandbox Code Playgroud) java ×1