dimanche 29 septembre 2019

Java - create generic class type at runtime

I have below line of code

 public static String getVOFromJson (String jsonString, Sting className) throws IOException {
     // className value is "MatchDetailsVO"
    MatchDetailsVO obj = mapper.readValue(jsonString, MatchDetailsVO.class);
}

Don't want to hard code MatchDetailsVO.class but want to create the class type at runtime using the variable className





Aucun commentaire:

Enregistrer un commentaire