简体   繁体   中英

Deep indexing of collection with hierarchical dozer

How to map data from the collection in dozer. Sharing the following sample. Kindly help me with same.

<field>
<a>person.addresses[0].address</a>
<b>employee.address</b>
</field>

How to iterate pojo class and map data from source to destination ?

I am getting the following exception

Getting Mapping Exceptions org.dozer.MappingException: No read or write method found for field.

Try deep index mapping hint

<field>
    <a>person.addresses[0].address</a>
    <b>employee.address</b>
    <a-deep-index-hint>org.yourpackage.person.entity.Address</a-deep-index-hint>      
</field>

or

Check your setter methods, If you have Unusual setter/getter methods you can specify the custom setter/getter methods.

<field>
    <a get-method="getAddress" >person.addresses[0].address</a>
    <b set-method="setAddress" >employee.address</b>
</field>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM