for the ObjectMapper a method accepts any class as a parameter
public <T extends MyClass> T getInstance(String json, Class<T> root) throws JsonProcessingException { return mapper.readValue(json, root); }