I am creating a DAO class that what it does for now is to bring to memory lists of objects from a json file. This method receives the name of a class and with that it should bring me the list of objects of that class but when I want to tell it that it is a list of instances of that class it tells me that it can not be solved to a type. I leave the code that I have (use jackson):
public List getAll(Class className) {
File json = new File(this.path);
ObjectMapper mapper = new ObjectMapper();
List<className> list = null;
try
{
list = mapper.readValue(json, new TypeReference<List<className>>() {});
}
catch (JsonGenerationException e) {
e.printStackTrace();
} catch (JsonMappingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return list;
}