1

How do you map a single field into a Set in Dozer?

I have a class like:

class FooDTO {
    private IdDto bar;
    private IdDto baz;
}

class FooDomainObject {
    private List<Id> ids;
}

I'd like to map bar and baz into the ids list, but I can't get it to do this.

palacsint
  • 28,416
  • 10
  • 82
  • 109
Dave
  • 13,518
  • 7
  • 42
  • 51

2 Answers2

2

I found this on the Dozer support list:

 http://sourceforge.net/projects/dozer/forums/forum/452530/topic/1557144

Basically, you use this syntax:

       <field>
            <a>bar</a>
            <b>ids[0]</b>
            <b-hint>org.foo.Id</b-hint>
        </field>
       <field>
            <a>baz</a>
            <b>ids[1]</b>
            <b-hint>org.foo.Id</b-hint>
        </field>
Dave
  • 13,518
  • 7
  • 42
  • 51
1

Is there a way to do sth. like this :

<mapping> 
    <class-a>SourceObject</class-a> 
    <class-b>blaObject</class-b> 
    <field>
        <a>sourceObjectSubObject[standardID].fielda</a>
        <b>blaDestField</b> 
    </field> 
</mapping>

Where the standardID is a field in the sourceObject, and the sourceObjectSubObject is a List<sourceObjectSubObject>.

palacsint
  • 28,416
  • 10
  • 82
  • 109
ITR
  • 53
  • 1
  • 10