1

I have a mapper like: Cat toAnotherCat(Cat origin); And I need an another mapper like that (CatsHouse has a property: Cat oneOfCats;): CatsHouse toNewCatsHouse(CatsHouse catsHouse)

When I run Maven build, in toNewCatsHouse implementation I see newCatHouse.setOneOfCats(toAnotherCat(catsHouse.getOneOfCats()))

But I need newCatHouse.setOneOfCats(catsHouse.getOneOfCats()) instead of this

How can I get it? How can I prohibit to use toAnotherCat automatically?

1 Answer 1

0

I found the solution: using MappingControl.Use.DIRECT I create an annotation:

@Retention(RetentionPolicy.CLASS)
@MappingControl( MappingControl.Use.DIRECT )
public @interface DirectMappingControl {
}

And use on toNewCatsHouse: @Mapping(target = "oneOfCats", mappingControl = DirectMappingControl.class)

Not the answer you're looking for? Browse other questions tagged or ask your own question.