Search code examples
mappingdozersequential

Is the mapping in sequential order in Dozer?


I have Dozer mapping as follows

<mapping>
      <class-a>Class1</class-a>
      <class-b>Class2</class-b>
           <field>  <a>C1.field1</a>  <b>C2.field1</b>  </field>
           <field custom-converter="converterField2">  <a>C1.field2</a>  <b>C2.field2</b>  </field>
           <field>  <a  custom-converter="converterField3">  C1.field3</a>        <b>C2.field3</b>  </field>
           <field>  <a>C1.field4</a>  <b>C2.field4</b>  </field>
</mapping>

I have four mappings mapping file. Does the Dozer maps in order like field1 is mapped first, followed by field2 and then by field3?

Or will do map in any order?


Solution

  • Yes, the mapping happens in order. The field names are fetched from the files by Reflection and added to Lists. These lists are then iterated over and the values mapped one by one.

    Specifically, the names are fetched here and the mapping starts here.