title: Dozer mapping for complex objects
body: <p>I have 2 POJOs as shown below :</p>
  
  <pre><code>package com.main.java.src;
  
      public class SourceObj {
  
      protected String name;
      ...
      ...
      10 String objects
  
      protected Addresses addresses; 
  
      ...
      ...
      getter and setter for all fields
  
      }
  ---------    
  package com.java.main.src;
  
      public class Addresses {
       protected List&lt;Address&gt; address;
      ...
      getters and setters
  </code></pre>
  
  <h2>        }</h2>
  
  <pre><code>    package com.main.java.src;
  
      public class Address {
         protected String city;
  
         protected List&lt;Contact&gt; contact;
  
      ...
  
      getters &amp; setters
      }
  
  -----
  package com.main.java.dest;
      public class DestObj {
  
      protected String name;
      ...
      ...
      10 String objects
  
      protected Addresses addresses; 
  
      ...
      ...
      getter and setter for all fields
  
      }
  
  ----------------
  package com.main.java.dest;
  
      public class Addresses {
       protected List&lt;Address&gt; address;
      ...
      getters and setters
      }
  
  package com.main.java.dest;
      public class Address {
         protected String city;
  
         protected List&lt;Contact&gt; contact;
  
      ...
  
      getters &amp; setters
      }
  
  Now i have the dozer-configuration.xml as follows:
  
      &lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://dozer.sourceforge.net http://dozer.sourceforge.net/schema/beanmapping.xsd"&gt;
          &lt;configuration&gt;
              &lt;stop-on-errors&gt;true&lt;/stop-on-errors&gt;
              &lt;trim-strings&gt;true&lt;/trim-strings&gt;
              &lt;relationship-type&gt;non-cumulative&lt;/relationship-type&gt;       
          &lt;/configuration&gt;
  
          &lt;mapping&gt;
              &lt;class-a&gt;com.main.java.src.SourceObj&lt;/class-a&gt;
              &lt;class-b&gt;com.main.java.dest.DestObj&lt;/class-b&gt;
              &lt;field&gt;
                  &lt;a&gt;addresses.address&lt;/a&gt;
                  &lt;b&gt;addresses.address&lt;/b&gt;
                  &lt;a-hint&gt;com.main.java.src.Address&lt;/a-hint&gt;
                  &lt;b-hint&gt;com.main.java.dest.Address&lt;/b-hint&gt;
              &lt;field&gt; 
          &lt;/mapping&gt;
      &lt;/mappings&gt;
  </code></pre>
  
  <p>Now the above mapping copies fields like name from SourceObj to DestObj, but not able to map List of Address from src package to List of Address of dest package. Again inside Address object, there is a list of Contact object.</p>
  
  <p>One solution i found is to write a custom converter which will copy primitive field values one by one and then all objects from one list to another destination list.</p>
  
  <p>But I am looking for a solution in dozer-configuration.xml.</p>
  
  <p>After the above xml mappings, i am getting below exception:</p>
  
  <pre><code>MapId: null
    Type: null
    Source parent class: com.main.java.src.SourceObj
    Source field name: addresses.address
    Source field type: class java.util.ArrayList
    Source field value: [com.main.java.src.Address@1b65d51d]
    Dest parent class: com.main.java.dest.DestObj
    Dest field name: addresses.address
    Dest field type: java.util.List
  
  java.lang.NullPointerException: null
      at org.dozer.util.ReflectionUtils.invoke(ReflectionUtils.java:329) ~[dozer-5.5.1.jar:?]
      at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.writeDeepDestinationValue(GetterSetterPropertyDescriptor.java:268) ~[dozer-5.5.1.jar:?]
      at org.dozer.propertydescriptor.GetterSetterPropertyDescriptor.setPropertyValue(GetterSetterPropertyDescriptor.java:96) ~[dozer-5.5.1.jar:?]
      at org.dozer.fieldmap.FieldMap.writeDestValue(FieldMap.java:96) ~[dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.writeDestinationValue(MappingProcessor.java:939) ~[dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.mapFromFieldMap(MappingProcessor.java:368) ~[dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.mapField(MappingProcessor.java:307) [dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.map(MappingProcessor.java:267) [dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.mapToDestObject(MappingProcessor.java:216) [dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.createByCreationDirectiveAndMap(MappingProcessor.java:196) [dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.mapGeneral(MappingProcessor.java:170) [dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.map(MappingProcessor.java:104) [dozer-5.5.1.jar:?]
      at org.dozer.MappingProcessor.map(MappingProcessor.java:99) [dozer-5.5.1.jar:?]
      at org.dozer.DozerBeanMapper.map(DozerBeanMapper.java:120) [dozer-5.5.1.jar:?]
  </code></pre>
  
  <p>Please advise with the solution for this case.</p>