tags:

views:

24

answers:

1

Hi all,

Quick question: I'm using Dozer to make mappings between two different classes. In my destination class (A in this example), I have a field which is an instance of a Name object. This object has two strings (last- and firstNames). These strings are build by inputting a list of strings and joining them together with a separator. In my source class(B) I have two lists (last- and firstNames). All lists contain only strings.

My dozer mapping looks like:

<mapping>
        <class-a>A</class-a>
        <class-b>B</class-b>
        <field>
            <a is-accessible="true" >name.lastNames</a>
            <b>lastNames</b>
        </field>
        <field>
            <a is-accessible="true">name.firstNames</a>
            <b>firstNames</b>
        </field>
    </mapping>

However, when using the above configuration, I get the following exception:

org.dozer.MappingException: No such field found class A.name.lastNames

Does anyone know if it is:

  • even possible to reference a field in such a manner?
  • a possible solution to what I'm doing wrong here?

To be complete: there are getters and setters defined on the Name object for both lists, however I have not written getters and setters on class A itself.

related questions