#220 Mapping String collections with "iterate" fails

Dozer v5.3.2

I have two classes, each with a Set of Strings called "names"
o Class WithAccessors contains getters and setters for the collection
o Class WithoutAccessors contains a getter, no setter, but an addName(String name) method

public class WithAccessors {

private Set<String> names = new HashSet<String>();

public Set<String> getNames() {
return names;
public void setNames(Set<String> names) {
this.names = names;

public class WithoutAccessors {

private Set<String> names = new HashSet<String>();

public void addName(String name) {
public Set<String> getNames() {
return names;

I provide a mapping as follows:

<b set-method="addName" type="iterate">names</b>

The following test fails:
public void someConversionStringCollectionUsingCustomAccessors() {

WithAccessors with = new WithAccessors();
Set<String> names = new HashSet<String>();

WithoutAccessors without = dozerBeanMapper.map(with, WithoutAccessors.class);
Assert.assertEquals(1, without.getNames().size());
Assert.assertEquals("foo", without.getNames().iterator().next());

The converted collection is the correct length (1) but contains an empty string.

The value to be set ("foo") is correct up until this point in the org.dozer.MappingProcessor.mapFromIterateMethodFieldMap(Object, Object, Object, FieldMap) method:
value = map(value, fieldMapping.getDestHintContainer().getHint());

At that point the returned value is empty.

It appears as if the method which is invoked tries to map a constant string value to a String object.


  • dmitry (lv)

    dmitry (lv) - 2010-06-01
    • assigned_to: nobody --> hedget
  • dmitry (lv)

    dmitry (lv) - 2010-12-31


  • dmitry (lv)

    dmitry (lv) - 2010-12-31
    • milestone: --> Dozer v5.3.2
    • assigned_to: hedget --> buzdin
    • status: open --> closed-fixed

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

No, thanks