aspose file tools*
The moose likes Other Application Frameworks and the fly likes Dozer Indexed Mapping - couldnt get the result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Dozer Indexed Mapping - couldnt get the result " Watch "Dozer Indexed Mapping - couldnt get the result " New topic
Author

Dozer Indexed Mapping - couldnt get the result

Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Hi,
I have already posted this question on Dozer support forum. If anyone here who has worked on Dozer indexed mapping can help me please. Thanks.

I have some classes generated from XSD using xjc available in JDK 1.6. And i have single Java Bean class having properties (required for my apps).

Now when i tried to custom map the Java Bean with the XSD classes. Its all fine for direct property to property mapping. But when i tried to map a String (nested inside List object) to String , i get below error.

Dest field type: java.lang.String
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.dozer.util.MappingUtils.isSupportedMap(MappingUtils.java:71)
at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:89)
at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:57)
at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:53)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.writeDeepDestinationValue(GetterSetterPropertyDescriptor.java:186)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.setPropertyValue(GetterSetterPropertyDescriptor.java:78)
at org.dozer.fieldmap.FieldMap.writeDestValue(FieldMap.java:91)
at org.dozer.MappingProcessor.writeDestinationValue(MappingProcessor.java:812)
at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:307)
at org.dozer.MappingProcessor.mapField(MappingProcessor.java:246)
at org.dozer.MappingProcessor.map(MappingProcessor.java:215)
at org.dozer.MappingProcessor.map(MappingProcessor.java:160)
at org.dozer.MappingProcessor.map(MappingProcessor.java:118)
at org.dozer.MappingProcessor.map(MappingProcessor.java:113)
at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:94)
at cc.iso.s20022.bsr.impl.MappingTester.main(MappingTester.java:44)
Exception in thread "main" java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.dozer.util.MappingUtils.isSupportedMap(MappingUtils.java:71)
at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:89)
at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:57)
at org.dozer.factory.DestBeanCreator.create(DestBeanCreator.java:53)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.writeDeepDestinationValue(GetterSetterPropertyDescriptor.java:186)
at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.setPropertyValue(GetterSetterPropertyDescriptor.java:78)
at org.dozer.fieldmap.FieldMap.writeDestValue(FieldMap.java:91)
at org.dozer.MappingProcessor.writeDestinationValue(MappingProcessor.java:812)
at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:307)
at org.dozer.MappingProcessor.mapField(MappingProcessor.java:246)
at org.dozer.MappingProcessor.map(MappingProcessor.java:215)
at org.dozer.MappingProcessor.map(MappingProcessor.java:160)
at org.dozer.MappingProcessor.map(MappingProcessor.java:118)
at org.dozer.MappingProcessor.map(MappingProcessor.java:113)
at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:94)
at cc.iso.s20022.bsr.impl.MappingTester.main(MappingTester.java:44)


Basically i dont understand how this indexed properyt works. I have a List of objects of B in a Class A. and I need to map a String from Class C to String in B.

<mapping wildcard="false">
<class-a>cc.iso.s20022.bsr.impl.C</class-a>
<class-b>cc.iso.s20022.bsr.xsd.A</class-b>
<field>
<a>code</a>
<b>b[0].code</b>
</field>
</mapping>

Here b is the List of objects (Class B) in class A , where B has a property String called code.Can anyone please help me on this. Thanks
 
 
subject: Dozer Indexed Mapping - couldnt get the result