What I'm trying to achieve is to instantiate children (new references) when i use a mapper on their parent (the children exist on destination object but i want to replace them with new references). I've read in the documentation that a mapper assumes that the destination object always exists. Indeed, the code below is not working :
@Override
public void mapBtoA(FooDto b, Foo a,
MappingContext context) {
a = new Foo();
a.setId(b.getId());
}
I think I should use a, ObjectFactory
or a Converter
but I have no idea how to call them implicitly when using a mapper on the parent.
Is that even possible ?
Without conviction I tried to define a BidirectionalConverter
, and when I ran my code it worked without doing anything more.
I thought Mappers and Converters were separate things but they actually work together.