Orika mapper

搜索:orika mapper fieldAToB nested field

https://orika-mapper.github.io/orika-docs/mappings-via-classmapbuilder.html

https://stackoverflow.com/questions/24445201/custom-mapping-with-orika

问题:
对象中嵌套对象,mapper 到另外一个对象。

The same pattern may be applied to refer to values in a Map by listing the key’s value within brackets, but the key value should be quoted (double or single); assuming that the ‘nameParts’ property from the previous example were defined as a Map<String, String>, we could reference individual key values like so:

mapperFactory.classMap(BasicPerson.class, BasicPersonDto.class)
   .field("nameParts['first']", "firstName")
   .field("nameParts[\"last\"]", "lastName")
   .register();

对象中嵌套数组,mapper到另外一个对象

mapperFactory.classMap(BasicPerson.class, BasicPersonDto.class)
   .field("nameParts[0]", "firstName")
   .field("nameParts[1]", "lastName")
   .register();
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。