Hi,
I want to map a bean in update mode. I define a Custom mapper for sublist (with an update mode too).
In that case, selma generate update mode for the wrong case.
Let see an example here : https://github.com/BenoitCharret/selma-test/tree/case_3
public class MySubMapper {
public List<AnotherSubElement> anotherSubElements(String element){
...
}
public List<AnotherSubElement> anotherSubElements(String element,List<AnotherSubElement> elements){
....
}
ToA asA(FromA fromA);
ToA asA(FromA fromA,ToA toA);
}
The generated code gives :
public final com.test.to.ToA asA(com.test.from.FromA in) {
com.test.to.ToA out = null;
if (in != null) {
out = new com.test.to.ToA();
out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement(), out.getInfos()));
@OverRide
public final com.test.to.ToA asA(com.test.from.FromA in, com.test.to.ToA out) {
if (in != null) {
if (out == null) {
out = new com.test.to.ToA();
}
out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement()));
I thought that on the first case, the call should be out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement()));
and on the second (update mode)
out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement(), out.getInfos()));
regards
The text was updated successfully, but these errors were encountered:
Got it there is a bug in hashcode from the TypeMirror class of JSR 269 :p. This was causing Selma not handling both custom mapping methods as the same Type pair.
Snapshot build should now be fixed for this buggy behavior.
Hi,
I want to map a bean in update mode. I define a Custom mapper for sublist (with an update mode too).
In that case, selma generate update mode for the wrong case.
Let see an example here : https://github.com/BenoitCharret/selma-test/tree/case_3
public class MySubMapper {
@Mapper(
withCustomFields = {
@field({"element", "infos"})
},
withCustom = {MySubMapper.class}
)
public interface MyMapper {
}
The generated code gives :
public final com.test.to.ToA asA(com.test.from.FromA in) {
com.test.to.ToA out = null;
if (in != null) {
out = new com.test.to.ToA();
out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement(), out.getInfos()));
@OverRide
public final com.test.to.ToA asA(com.test.from.FromA in, com.test.to.ToA out) {
if (in != null) {
if (out == null) {
out = new com.test.to.ToA();
}
out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement()));
I thought that on the first case, the call should be out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement()));
and on the second (update mode)
out.setInfos(customMapperMySubMapper.anotherSubElements(in.getElement(), out.getInfos()));
regards
The text was updated successfully, but these errors were encountered: