Dozer deep mapping not working
Posted
by user363900
on Stack Overflow
See other posts from Stack Overflow
or by user363900
Published on 2010-06-10T19:59:53Z
Indexed on
2010/06/10
20:02 UTC
Read the original article
Hit count: 921
I am trying to use dozer to map between classes. I have a source class that looks like this:
public class initRequest{
protected String id;
protected String[] details
}
I have a destination class that looks like this:
public class initResponse{
protected String id;
protected DetailsObject detObj;
}
public class DetailsObject{
protected List<String> details;
}
So essentially i want the string in the details array to be populated into the List in the Details object.
I have tried a mapping like this:
<mapping wildcard="true" >
<class-a>com.starwood.valhalla.sgpms.dto.InitiateSynchronizationDTO</class-a>
<class-b>com.starwood.valhalla.psi.sgpms.dto.InitiateSynchronizationDTO</class-b>
<field>
<a is-accessible="true">reservations</a>
<b is-accessible="true">reservations.confirmationNum</b>
</field>
</mapping>
But I get this error:
Exception in thread "main" net.sf.dozer.util.mapping.MappingException: java.lang.NoSuchFieldException: reservations.confirmationNum
at net.sf.dozer.util.mapping.util.MappingUtils.throwMappingException(MappingUtils.java:91)
at net.sf.dozer.util.mapping.propertydescriptor.FieldPropertyDescriptor.<init>(FieldPropertyDescriptor.java:43)
at net.sf.dozer.util.mapping.propertydescriptor.PropertyDescriptorFactory.getPropertyDescriptor(PropertyDescriptorFactory.java:53)
at net.sf.dozer.util.mapping.fieldmap.FieldMap.getDestPropertyDescriptor(FieldMap.java:370)
at net.sf.dozer.util.mapping.fieldmap.FieldMap.getDestFieldType(FieldMap.java:103)
at net.sf.dozer.util.mapping.util.MappingsParser.processMappings(MappingsParser.java:95)
at net.sf.dozer.util.mapping.util.CustomMappingsLoader.load(CustomMappingsLoader.java:77)
at net.sf.dozer.util.mapping.DozerBeanMapper.loadCustomMappings(DozerBeanMapper.java:149)
at net.sf.dozer.util.mapping.DozerBeanMapper.getMappingProcessor(DozerBeanMapper.java:132)
at net.sf.dozer.util.mapping.DozerBeanMapper.map(DozerBeanMapper.java:94)
at com.starwood.valhalla.mte.translator.StarguestPMSIntegrationDozerAdapter.adaptInit(StarguestPMSIntegrationDozerAdapter.java:30)
How can i map this so that it works?
© Stack Overflow or respective owner