private static User yaml() throws IOException, JsonParseException, JsonMappingException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
return mapper.readValue(new File("user.yaml"), User.class);
}
Above code is specific to "User" class
I want to make it generic like this,
private static <T> T yaml() throws IOException, JsonParseException, JsonMappingException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
return mapper.readValue(new File("user.yaml"), T.class);
}
But getting error at T.class, Can anyone suggest on this please?