#33 Hint is not used for Array to List

closed
None
5
2006-02-02
2006-01-24
No

public class KarthikTestObject extends BaseTestObject {
private Integer[] one;
public Integer[] getOne() {
return one;
}
public void setOne(Integer[] one) {
this.one = one;
}
}

public class KarthikTestObjectPrime extends
BaseTestObject {
private List one;
public List getOne() {
return one;
}
public void setOne(List one) {
this.one = one;
System.out.println( "Class of first object in
List is " +
this.one.get(0).getClass() );
}
}

Test Case:

public class AKarthikMapperTest extends DozerTestBase {

public void testGeneralMapping() throws Exception {
KarthikTestObject testObj = new
KarthikTestObject();
Integer[] intArr = { new Integer(1), new
Integer(2) };
testObj.setOne(intArr);
KarthikTestObjectPrime testObjPrime =
( KarthikTestObjectPrime ) mapper.map(
testObj,
KarthikTestObjectPrime.class );

assertEquals( testObj, testObj );
}

}

Mapping:

<mapping>

<class-a>net.sf.dozer.util.mapping.vo.KarthikTestObject</class-a>

<class-b>net.sf.dozer.util.mapping.vo.KarthikTestObjectPrime</class-b>

<field>
<a>one</a>
<b>one</b>
<b-hint>java.lang.String</b-hint>
</field>

</mapping>

Inspite of giving a hint for java.lang.String,
KarthikTestObjectPrime
still
prints the class at java.lang.Integer. Is this the
expected behavior?

Discussion

  • Franz Garsombke

    Franz Garsombke - 2006-01-24

    Logged In: YES
    user_id=550744

    This is fixed and in the v20 branch. I have attached the
    patched file to this ticket.

     
  • Franz Garsombke

    Franz Garsombke - 2006-02-02
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks