package ch.johannes.examples.mapstruct;

import ch.johannes.examples.mapper.person.Person;
import ch.johannes.examples.mapper.person.PersonTO;
import ch.johannes.examples.mapper.pet.Pet;
import ch.johannes.examples.mapper.pet.PetTO;
import ch.johannes.examples.mapper.product.Product;
import ch.johannes.examples.mapper.product.ProductTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper
public interface MapStructMapper {

    @Mappings({
            @Mapping(source = "productIdentifier", target = "id"),
            @Mapping(source = "productName", target = "name")
    })
    ProductTO productToProductTO(Product product);

    PetTO petToPetTO(Pet pet);

}

@@ -34,16 +34,120 @@
 truct;%0A%0A
+import ch.johannes.examples.mapper.person.Address;%0Aimport ch.johannes.examples.mapper.person.AddressTO;%0A
 import c
@@ -188,16 +188,16 @@
 Person;%0A
-
 import c
@@ -495,16 +495,52 @@
 apping;%0A
+import org.mapstruct.MappingTarget;%0A
 import o
@@ -811,16 +811,16 @@
 duct);%0A%0A
-
     PetT
@@ -843,10 +843,482 @@
  pet);%0A%0A
+    @Mappings(%7B%0A    %7D)%0A    PersonTO personToPersonTO(Person person);%0A%0A    default void personToPersonTOAdditions(Person person, @MappingTarget PersonTO personTO) %7B%0A        personTO.setFirstNickname(person.getNicknames().get(0));%0A    %7D;%0A%0A%0A    @Mappings(%7B%0A            @Mapping(source = %22country.countryName%22, target = %22country%22),%0A            @Mapping(source = %22country.countryIsoCode%22, target = %22countryIsoCode%22)%0A    %7D)%0A    AddressTO addressToAddressTO(Address address);%0A%0A%0A%0A
 %7D%0A

Use default method