New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selma don't retrieve setter #65

Closed
BenoitCharret opened this Issue Oct 22, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@BenoitCharret

BenoitCharret commented Oct 22, 2015

Hi,

I have a made a sample test case where selma doesn't retrieve a setter whereas it exists.

You can find it here : https://github.com/BenoitCharret/selma-test/tree/case_1

What I got is :
[ERROR] /home/benoit/projects/selma-test/src/main/java/com/test/SubElementMapper.java:[17,27] setter for field id from source bean com.test.from.SubSubElement is missing in destination bean com.test.to.AnotherSubElement !
[ERROR] --> Add @Mapper(withIgnoreFields="com.test.from.SubSubElement.id") / @maps(withIgnoreFields="com.test.from.SubSubElement.id") to mapper interface / method or add missing getter or specify corresponding @field to customize field to field mapping
[ERROR] setter for field id from destination bean com.test.to.AnotherSubElement has no getter in source bean com.test.from.SubSubElement !
[ERROR] --> Add @Mapper(withIgnoreFields="com.test.to.AnotherSubElement.id") / @maps(withIgnoreFields="com.test.to.AnotherSubElement.id") to mapper interface / method or add missing setter or specify corresponding @field to customize field to field mapping

But my object are

public class SubSubElement {
private String id;

public String getId() {
    return id;
}

public void setId(String id) {
    this.id = id;
}

}

and

public class AnotherSubElement {

private String id;

public String getId() {
    return id;
}

public void setId(String id) {
    this.id = id;
}

}

Thanks for your help

slemesle added a commit that referenced this issue Oct 22, 2015

#65: Fix custom field resolver using startsWith without checking the …
…complete field name so 'id' field was falling in 'idA' custom field
@slemesle

This comment has been minimized.

Show comment
Hide comment
@slemesle

slemesle Oct 22, 2015

This is now fixed in snapshot. But you can simply fix it by moving the customField mapping to the method of the mapper where it should be used instead of putting it on mapper interface.

Specifying the simple class name in the custom field would also fix the build.

The bug was making the id field falling in the custom mapping specified for 'idA' because Selma was matchsing using a startsWith.

slemesle commented Oct 22, 2015

This is now fixed in snapshot. But you can simply fix it by moving the customField mapping to the method of the mapper where it should be used instead of putting it on mapper interface.

Specifying the simple class name in the custom field would also fix the build.

The bug was making the id field falling in the custom mapping specified for 'idA' because Selma was matchsing using a startsWith.

@slemesle slemesle closed this Oct 27, 2015

@slemesle slemesle added the bug label Nov 18, 2015

@slemesle slemesle added this to the 0.13 milestone Nov 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment