I'm still struggling with some of the basic uses of Generics, this time with Jackson. Neither of these work right. The first returns a list of LinkedHashMaps instead of a list of type T. The second can't see the variable "type" on the last line.
Can anyone tell me what I'm doing wrong :
public <T> List<T> readObjects(File file)
{
File file = new File(subscriptionDir, fileName)
return mapper.readValue(file, new TypeReference<List<T>>() {})
}
public <T> List<T> readObjects(String fileName, Class<T> type)
{
File file = new File(subscriptionDir, fileName)
return mapper.readValue(file, new TypeReference<List<type>>(){})
}
Thanks in advanced for any assistance.