Java introspection: object to map

后端 未结 7 971
无人及你
无人及你 2020-11-28 05:52

I have a Java object obj that has attributes obj.attr1, obj.attr2 etc. The attributes are possibly accessed through an extra level of

7条回答
  •  一整个雨季
    2020-11-28 06:11

    Another way to user JacksonObjectMapper is the convertValue ex:

     ObjectMapper m = new ObjectMapper();
     Map mappedObject = m..convertValue(myObject, new TypeReference>() {});
    

提交回复
热议问题