Raj - 2011-09-21

Hello,

I am trying to map the object hierarchy below and it does not copy the contents:

public class A {
    private B b;
       public A() {
        this.b = new B();
    }
    // getter and setter.
}





public class B {
    private int[] array;
       
        public B() {
        array = new int[5];
    }
    // getter and setter.
}





public class C {
    private int one;
    private int two;
    private int three;
    private int four;
    private int five;

        // getters and setters.
}

This is the mapping XML used:

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <mapping wildcard="false" map-null="false" map-id="testing">

    <class-a>A</class-a>
    <class-b is-accessible="true">C</class-b>

    <field>
        <a>b.array[0]</a>
        <b>one</b>
        <a-hint>java.lang.Integer</a-hint>
        <b-hint>java.lang.Integer</b-hint>
        <a-deep-index-hint>java.lang.Integer</a-deep-index-hint>
    </field>

    <field>
        <a>b.array[1]</a>
        <b>two</b>
        <a-hint>int</a-hint>
        <b-hint>int</b-hint>
    </field>

    <field>
        <a>b.array[2]</a>
        <b>three</b>
        <a-hint>int</a-hint>
        <b-hint>int</b-hint>
    </field>

    <field>
        <a>b.array[3]</a>
        <b>four</b>
    </field>

    <field>
        <a>b.array[4]</a>
        <b>five</b>
    </field>

    </mapping>
</mappings>

Any suggestions are welcome…

Cheers,
Raj.