diff --git a/example/pom.xml b/example/pom.xml
index e945593..88c1d1e 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -21,6 +21,7 @@
1.4.1-SNAPSHOT
1.18.22
5.8.26
+ 32.1.3-jre
@@ -50,6 +51,11 @@
hutool-all
${hutool.version}
+
+ com.google.guava
+ guava
+ ${guava.version}
+
diff --git a/example/spring-boot-with-lombok/pom.xml b/example/spring-boot-with-lombok/pom.xml
index 81a92c8..34776f9 100644
--- a/example/spring-boot-with-lombok/pom.xml
+++ b/example/spring-boot-with-lombok/pom.xml
@@ -50,6 +50,10 @@
cn.hutool
hutool-all
+
+ com.google.guava
+ guava
+
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/MapStructPlusConfiguration.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/MapStructPlusConfiguration.java
index e9849a7..7e5302a 100644
--- a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/MapStructPlusConfiguration.java
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/MapStructPlusConfiguration.java
@@ -1,12 +1,14 @@
package io.github.linpeilie;
import io.github.linpeilie.annotations.MapperConfig;
+import org.mapstruct.Builder;
@MapperConfig(adapterClassName = "DemoConvertMapperAdapter",
adapterPackage = "io.github.linpeilie.adapter",
mapAdapterClassName = "DemoMapConvertMapperAdapter",
autoConfigPackage = "cn.easii",
autoMapperConfigClassName = "EasiiAutoMapperConfig",
- autoMapMapperConfigClassName = "EasiiAutoMapMapperConfig")
+ autoMapMapperConfigClassName = "EasiiAutoMapMapperConfig",
+ builder = @Builder(disableBuilder = false))
public class MapStructPlusConfiguration {
}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/mapper/Titles.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/mapper/Titles.java
index a30b35d..3374568 100644
--- a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/mapper/Titles.java
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/mapper/Titles.java
@@ -13,6 +13,9 @@ public class Titles {
if ("One Hundred Years of Solitude".equals(title)) {
return "Cent ans de solitude";
}
+ if ("Default".equals(title)) {
+ return null;
+ }
return "Inconnu et inconnu";
}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/NoProperties.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/NoProperties.java
new file mode 100644
index 0000000..3a70260
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/NoProperties.java
@@ -0,0 +1,12 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me;
+
+/**
+ * @author Filip Hrisafov
+ */
+public class NoProperties {
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/WithProperties.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/WithProperties.java
new file mode 100644
index 0000000..e503a50
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/WithProperties.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+/**
+ * @author Filip Hrisafov
+ */
+@AutoMapper(target = NoProperties.class)
+public class WithProperties {
+
+ private String string;
+
+ public String getString() {
+ return string;
+ }
+
+ public void setString(String string) {
+ this.string = string;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/array/Scientist.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/array/Scientist.java
new file mode 100644
index 0000000..cdc07a4
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/array/Scientist.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.array;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+@AutoMapper(target = ScientistDto.class)
+public class Scientist {
+
+ //CHECKSTYLE:OFF
+ public String[] publicPublications;
+ public String[] publicPublicationYears;
+ //CHECKSTYLE:ON
+ private String name;
+ private String[] publications;
+ private String[] publicationYears;
+
+ public Scientist(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String[] getPublications() {
+ return publications;
+ }
+
+ public void setPublications(String[] publications) {
+ this.publications = publications;
+ }
+
+ public String[] getPublicationYears() {
+ return publicationYears;
+ }
+
+ public void setPublicationYears(String[] publicationYears) {
+ this.publicationYears = publicationYears;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/array/ScientistDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/array/ScientistDto.java
new file mode 100644
index 0000000..175e5da
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/array/ScientistDto.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.array;
+
+public class ScientistDto {
+
+ //CHECKSTYLE:OFF
+ public String[] publicPublications;
+ public int[] publicPublicationYears;
+ //CHECKSTYLE:ON
+
+ private String name;
+ private String[] publications;
+ private int[] publicationYears;
+
+ public ScientistDto() {
+ }
+
+ public ScientistDto(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String[] getPublications() {
+ return publications;
+ }
+
+ public void setPublications(String[] publications) {
+ this.publications = publications;
+ }
+
+ public int[] getPublicationYears() {
+ return publicationYears;
+ }
+
+ public void setPublicationYears(int[] publicationYears) {
+ this.publicationYears = publicationYears;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/Person.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/Person.java
new file mode 100644
index 0000000..54948df
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/Person.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.bool;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+@AutoMapper(target = PersonDto.class, uses = YesNoMapper.class, reverseConvertGenerate = false)
+public class Person {
+
+ private Boolean married;
+ private Boolean engaged;
+ private YesNo divorced;
+ private YesNo widowed;
+
+ public Boolean isMarried() {
+ return married;
+ }
+
+ public void setMarried(Boolean married) {
+ this.married = married;
+ }
+
+ // START: please note: deliberately ordered, first getEngaged, then isEngaged.
+ public Boolean getEngaged() {
+ return engaged;
+ }
+
+ public Boolean isEngaged() {
+ return engaged != null && !engaged;
+ }
+ // END
+
+ public void setEngaged(Boolean engaged) {
+ this.engaged = engaged;
+ }
+
+ public YesNo getDivorced() {
+ return divorced;
+ }
+
+ public void setDivorced(YesNo divorced) {
+ this.divorced = divorced;
+ }
+
+ public YesNo getWidowed() {
+ return widowed;
+ }
+
+ public void setWidowed(YesNo widowed) {
+ this.widowed = widowed;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/PersonDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/PersonDto.java
new file mode 100644
index 0000000..0768d89
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/PersonDto.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.bool;
+
+public class PersonDto {
+
+ private String married;
+ private String engaged;
+ private String divorced;
+ private Boolean widowed;
+
+ public String getMarried() {
+ return married;
+ }
+
+ public void setMarried(String married) {
+ this.married = married;
+ }
+
+ public String getEngaged() {
+ return engaged;
+ }
+
+ public void setEngaged(String engaged) {
+ this.engaged = engaged;
+ }
+
+ public String getDivorced() {
+ return divorced;
+ }
+
+ public void setDivorced(String divorced) {
+ this.divorced = divorced;
+ }
+
+ public Boolean getWidowed() {
+ return widowed;
+ }
+
+ public void setWidowed(Boolean widowed) {
+ this.widowed = widowed;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/YesNo.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/YesNo.java
new file mode 100644
index 0000000..5389beb
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/YesNo.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.bool;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+public class YesNo {
+ private boolean yes;
+
+ public YesNo(boolean yes) {
+ this.yes = yes;
+ }
+
+ public boolean isYes() {
+ return yes;
+ }
+
+ public void setYes(boolean yes) {
+ this.yes = yes;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/YesNoMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/YesNoMapper.java
new file mode 100644
index 0000000..e5f8f2e
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/bool/YesNoMapper.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.bool;
+
+import org.mapstruct.Mapper;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+@Component
+public class YesNoMapper {
+ public String toString(YesNo yesNo) {
+ if ( null != yesNo && yesNo.isYes() ) {
+ return "yes";
+ }
+
+ return "no";
+ }
+
+ public boolean toBool(YesNo yesNo) {
+ return ( null != yesNo && yesNo.isYes() );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/AbstractImmutableProduct.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/AbstractImmutableProduct.java
new file mode 100644
index 0000000..6ed77d1
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/AbstractImmutableProduct.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractBuilder;
+
+/**
+ * @author Filip Hrisafov
+ */
+public abstract class AbstractImmutableProduct {
+
+ private final String name;
+
+ public AbstractImmutableProduct(AbstractProductBuilder> builder) {
+ this.name = builder.name;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/AbstractProductBuilder.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/AbstractProductBuilder.java
new file mode 100644
index 0000000..8385b8d
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/AbstractProductBuilder.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractBuilder;
+
+public abstract class AbstractProductBuilder {
+
+ protected String name;
+
+ public AbstractProductBuilder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public abstract T build();
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/ImmutableProduct.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/ImmutableProduct.java
new file mode 100644
index 0000000..4d445ef
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/ImmutableProduct.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractBuilder;
+
+public class ImmutableProduct extends AbstractImmutableProduct {
+
+ private final Integer price;
+
+ public ImmutableProduct(ImmutableProductBuilder builder) {
+ super( builder );
+ this.price = builder.price;
+ }
+
+ public static ImmutableProductBuilder builder() {
+ return new ImmutableProductBuilder();
+ }
+
+ public Integer getPrice() {
+ return price;
+ }
+
+ public static class ImmutableProductBuilder extends AbstractProductBuilder {
+ private Integer price;
+
+ public ImmutableProductBuilder price(Integer price) {
+ this.price = price;
+ return this;
+ }
+
+ @Override
+ public ImmutableProduct build() {
+ return new ImmutableProduct( this );
+ }
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/ProductDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/ProductDto.java
new file mode 100644
index 0000000..b1048d3
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractBuilder/ProductDto.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractBuilder;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+@AutoMapper(target = ImmutableProduct.class)
+public class ProductDto {
+ private String name;
+ private Integer price;
+
+ public ProductDto() {
+ }
+
+ public ProductDto(String name, Integer price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Integer getPrice() {
+ return price;
+ }
+
+ public void setPrice(Integer price) {
+ this.price = price;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/Child.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/Child.java
new file mode 100644
index 0000000..43e7650
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/Child.java
@@ -0,0 +1,10 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+public interface Child {
+ String getName();
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ChildSource.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ChildSource.java
new file mode 100644
index 0000000..c76df2e
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ChildSource.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+@AutoMapper(target = ImmutableChild.class)
+public class ChildSource {
+ private String name;
+
+ public ChildSource() {
+ }
+
+ public ChildSource(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ImmutableChild.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ImmutableChild.java
new file mode 100644
index 0000000..3f3ff93
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ImmutableChild.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+public class ImmutableChild implements Child {
+ private final String name;
+
+ private ImmutableChild(Builder builder) {
+ this.name = builder.name;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public static class Builder {
+ private String name;
+
+ public Builder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public ImmutableChild build() {
+ return new ImmutableChild( this );
+ }
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ImmutableParent.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ImmutableParent.java
new file mode 100644
index 0000000..3229f0e
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ImmutableParent.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+public class ImmutableParent implements Parent {
+ private final int count;
+ private final ImmutableChild child;
+ private final Child nonGenericChild;
+
+ public ImmutableParent(Builder builder) {
+ this.count = builder.count;
+ this.child = builder.child;
+ this.nonGenericChild = builder.nonGenericChild;
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ @Override
+ public Child getNonGenericChild() {
+ return nonGenericChild;
+ }
+
+ @Override
+ public int getCount() {
+ return count;
+ }
+
+ @Override
+ public ImmutableChild getChild() {
+ return child;
+ }
+
+ public static class Builder {
+ private int count;
+ private ImmutableChild child;
+ private Child nonGenericChild;
+
+ public Builder count(int count) {
+ this.count = count;
+ return this;
+ }
+
+ public Builder nonGenericChild(Child nonGenericChild) {
+ this.nonGenericChild = nonGenericChild;
+ return this;
+ }
+
+ public Builder child(ImmutableChild child) {
+ this.child = child;
+ return this;
+ }
+
+ public ImmutableParent build() {
+ return new ImmutableParent( this );
+ }
+
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/MutableChild.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/MutableChild.java
new file mode 100644
index 0000000..6bf2ebc
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/MutableChild.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+public class MutableChild implements Child {
+ private String name;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/MutableParent.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/MutableParent.java
new file mode 100644
index 0000000..8c3caeb
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/MutableParent.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+public class MutableParent implements Parent {
+ private int count;
+ private ImmutableChild child;
+ private Child nonGenericChild;
+
+ @Override
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ @Override
+ public ImmutableChild getChild() {
+ return child;
+ }
+
+ public void setChild(ImmutableChild child) {
+ this.child = child;
+ }
+
+ @Override
+ public Child getNonGenericChild() {
+ return nonGenericChild;
+ }
+
+ public void setNonGenericChild(Child nonGenericChild) {
+ this.nonGenericChild = nonGenericChild;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/Parent.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/Parent.java
new file mode 100644
index 0000000..72a0af6
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/Parent.java
@@ -0,0 +1,14 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+public interface Parent {
+ int getCount();
+
+ T getChild();
+
+ Child getNonGenericChild();
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ParentSource.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ParentSource.java
new file mode 100644
index 0000000..74271fc
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/abstractGenericTarget/ParentSource.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.builder.abstractGenericTarget;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMappers;
+
+@AutoMappers({
+ @AutoMapper(target = ImmutableParent.class),
+ @AutoMapper(target = MutableParent.class)
+})
+public class ParentSource {
+ private int count;
+ private ChildSource child;
+ private ChildSource nonGenericChild;
+
+ public ChildSource getNonGenericChild() {
+ return nonGenericChild;
+ }
+
+ public void setNonGenericChild(ChildSource nonGenericChild) {
+ this.nonGenericChild = nonGenericChild;
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setCount(int count) {
+ this.count = count;
+ }
+
+ public ChildSource getChild() {
+ return child;
+ }
+
+ public void setChild(ChildSource child) {
+ this.child = child;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/BuilderFactoryMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/BuilderFactoryMapper.java
new file mode 100644
index 0000000..088ec34
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/BuilderFactoryMapper.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.factory;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.ObjectFactory;
+import org.mapstruct.factory.Mappers;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Component
+public class BuilderFactoryMapper {
+
+ @ObjectFactory
+ public Person.PersonBuilder personBuilder() {
+ return new Person.PersonBuilder( "Factory with @ObjectFactory" );
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/BuilderImplicitFactoryMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/BuilderImplicitFactoryMapper.java
new file mode 100644
index 0000000..2a7ae85
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/BuilderImplicitFactoryMapper.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.builder.factory;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Filip Hrisafov
+ */
+@Component
+public class BuilderImplicitFactoryMapper {
+
+ public ImplicitPerson.PersonBuilder personBuilder() {
+ return new ImplicitPerson.PersonBuilder("Implicit Factory");
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/ImplicitPerson.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/ImplicitPerson.java
new file mode 100644
index 0000000..0685331
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/ImplicitPerson.java
@@ -0,0 +1,43 @@
+package io.github.linpeilie.me.builder.factory;
+
+public class ImplicitPerson {
+
+ private final String name;
+ private final String source;
+
+ protected ImplicitPerson(ImplicitPerson.PersonBuilder builder) {
+ this.name = builder.name;
+ this.source = builder.source;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public static ImplicitPerson.PersonBuilder builder() {
+ throw new UnsupportedOperationException( "Factory should be used" );
+ }
+
+ public static class PersonBuilder {
+ private String name;
+ private final String source;
+
+ public PersonBuilder(String source) {
+ this.source = source;
+ }
+
+ public ImplicitPerson.PersonBuilder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public ImplicitPerson build() {
+ return new ImplicitPerson( this );
+ }
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/Person.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/Person.java
new file mode 100644
index 0000000..bfa2a0b
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/Person.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.factory;
+
+/**
+ * @author Filip Hrisafov
+ */
+public class Person {
+
+ private final String name;
+ private final String source;
+
+ protected Person(PersonBuilder builder) {
+ this.name = builder.name;
+ this.source = builder.source;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public static PersonBuilder builder() {
+ throw new UnsupportedOperationException( "Factory should be used" );
+ }
+
+ public static class PersonBuilder {
+ private String name;
+ private final String source;
+
+ public PersonBuilder(String source) {
+ this.source = source;
+ }
+
+ public PersonBuilder name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public Person build() {
+ return new Person( this );
+ }
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/PersonDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/PersonDto.java
new file mode 100644
index 0000000..9da8384
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/builder/factory/PersonDto.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.builder.factory;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMappers;
+
+/**
+ * @author Filip Hrisafov
+ */
+@AutoMappers({
+ @AutoMapper(target = Person.class, uses = BuilderFactoryMapper.class, reverseConvertGenerate = false),
+ @AutoMapper(target = ImplicitPerson.class, uses = BuilderImplicitFactoryMapper.class, reverseConvertGenerate = false),
+})
+public class PersonDto {
+
+ private String name;
+
+ public PersonDto(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/BaseMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/BaseMapper.java
new file mode 100644
index 0000000..9e8173e
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/BaseMapper.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.mapstruct.AfterMapping;
+import org.mapstruct.BeforeMapping;
+import org.mapstruct.MappingTarget;
+import org.mapstruct.TargetType;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Andreas Gudian
+ */
+@Component
+public class BaseMapper {
+
+ private static final List INVOCATIONS = new ArrayList();
+
+ @BeforeMapping
+ public void noArgsBeforeMapping() {
+ INVOCATIONS.add( new Invocation( "noArgsBeforeMapping" ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(Source source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ @Qualified
+ public void withSourceBeforeMappingQualified(Source source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMappingQualified", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(SourceEnum source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(List source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ @Qualified
+ public void withSourceBeforeMappingQualified(List source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMappingQualified", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(Map source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ @Qualified
+ public void withSourceBeforeMappingQualified(Map source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMappingQualified", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAsObjectBeforeMapping(Object source) {
+ INVOCATIONS.add( new Invocation( "withSourceAsObjectBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(Source source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(SourceEnum source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(List source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(Map source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(Source source, @MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(SourceEnum source, @MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(List source, @MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(Map source,
+ @MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetAsObjectBeforeMapping(@MappingTarget Object target) {
+ INVOCATIONS.add( new Invocation( "withTargetAsObjectBeforeMapping", target ) );
+ }
+
+ @AfterMapping
+ public void noArgsAfterMapping() {
+ INVOCATIONS.add( new Invocation( "noArgsAfterMapping" ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(Source source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(SourceEnum source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(List source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(Map source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAsObjectAfterMapping(Object source) {
+ INVOCATIONS.add( new Invocation( "withSourceAsObjectAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(Source source, @MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(SourceEnum source, @MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(List source, @MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(Map source, @MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ @Qualified
+ public void withTargetAfterMappingQualified(@MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMappingQualified", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ @Qualified
+ public void withTargetAfterMappingQualified(@MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMappingQualified", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ @Qualified
+ public void withTargetAfterMappingQualified(@MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMappingQualified", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAsObjectAfterMapping(@MappingTarget Object target) {
+ INVOCATIONS.add( new Invocation( "withTargetAsObjectAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAndTargetTypeAfterMapping(@MappingTarget T target, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withTargetAndTargetTypeAfterMapping", target, targetClass ) );
+ }
+
+ public static List getInvocations() {
+ return INVOCATIONS;
+ }
+
+ public static void reset() {
+ INVOCATIONS.clear();
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ClassContainingCallbacks.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ClassContainingCallbacks.java
new file mode 100644
index 0000000..b441be0
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ClassContainingCallbacks.java
@@ -0,0 +1,243 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.mapstruct.AfterMapping;
+import org.mapstruct.BeforeMapping;
+import org.mapstruct.MappingTarget;
+import org.mapstruct.TargetType;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Andreas Gudian
+ */
+@Component
+public class ClassContainingCallbacks {
+ private static final List INVOCATIONS = new ArrayList();
+
+ @BeforeMapping
+ public void noArgsBeforeMapping() {
+ INVOCATIONS.add( new Invocation( "noArgsBeforeMapping" ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(Source source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ @Qualified
+ public void withSourceBeforeMappingQualified(Source source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMappingQualified", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(SourceEnum source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(List source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ @Qualified
+ public void withSourceBeforeMappingQualified(List source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMappingQualified", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceBeforeMapping(Map source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ @Qualified
+ public void withSourceBeforeMappingQualified(Map source) {
+ INVOCATIONS.add( new Invocation( "withSourceBeforeMappingQualified", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAsObjectBeforeMapping(Object source) {
+ INVOCATIONS.add( new Invocation( "withSourceAsObjectBeforeMapping", source ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(Source source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(SourceEnum source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(List source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetTypeBeforeMapping(Map source, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetTypeBeforeMapping", source, targetClass ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(Source source, @MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(SourceEnum source, @MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(List source, @MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withSourceAndTargetBeforeMapping(Map source,
+ @MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetBeforeMapping", source, target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetBeforeMapping(@MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withTargetBeforeMapping", target ) );
+ }
+
+ @BeforeMapping
+ public void withTargetAsObjectBeforeMapping(@MappingTarget Object target) {
+ INVOCATIONS.add( new Invocation( "withTargetAsObjectBeforeMapping", target ) );
+ }
+
+ @AfterMapping
+ public void noArgsAfterMapping() {
+ INVOCATIONS.add( new Invocation( "noArgsAfterMapping" ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(Source source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(SourceEnum source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(List source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAfterMapping(Map source) {
+ INVOCATIONS.add( new Invocation( "withSourceAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAsObjectAfterMapping(Object source) {
+ INVOCATIONS.add( new Invocation( "withSourceAsObjectAfterMapping", source ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(Source source, @MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(SourceEnum source, @MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(List source, @MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withSourceAndTargetAfterMapping(Map source, @MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withSourceAndTargetAfterMapping", source, target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget TargetEnum target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ @Qualified
+ public void withTargetAfterMappingQualified(@MappingTarget Target target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMappingQualified", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ @Qualified
+ public void withTargetAfterMappingQualified(@MappingTarget List target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMappingQualified", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAfterMapping(@MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ @Qualified
+ public void withTargetAfterMappingQualified(@MappingTarget Map target) {
+ INVOCATIONS.add( new Invocation( "withTargetAfterMappingQualified", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAsObjectAfterMapping(@MappingTarget Object target) {
+ INVOCATIONS.add( new Invocation( "withTargetAsObjectAfterMapping", target ) );
+ }
+
+ @AfterMapping
+ public void withTargetAndTargetTypeAfterMapping(@MappingTarget T target, @TargetType Class targetClass) {
+ INVOCATIONS.add( new Invocation( "withTargetAndTargetTypeAfterMapping", target, targetClass ) );
+ }
+
+ public static List getInvocations() {
+ return INVOCATIONS;
+ }
+
+ public static void reset() {
+ INVOCATIONS.clear();
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Invocation.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Invocation.java
new file mode 100644
index 0000000..9a46e94
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Invocation.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks;
+
+import java.util.Arrays;
+
+/**
+ * @author Andreas Gudian
+ */
+public class Invocation {
+ private final String methodName;
+ private final String arguments;
+
+ public Invocation(String methodName, Object... arguments) {
+ this.methodName = methodName;
+ this.arguments = Arrays.toString( arguments );
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public String getArguments() {
+ return arguments;
+ }
+
+ @Override
+ public String toString() {
+ return "Invocation [methodName=" + methodName + ", arguments=" + arguments + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ( ( arguments == null ) ? 0 : arguments.hashCode() );
+ result = prime * result + ( ( methodName == null ) ? 0 : methodName.hashCode() );
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( this == obj ) {
+ return true;
+ }
+ if ( obj == null ) {
+ return false;
+ }
+ if ( getClass() != obj.getClass() ) {
+ return false;
+ }
+ Invocation other = (Invocation) obj;
+ if ( arguments == null ) {
+ if ( other.arguments != null ) {
+ return false;
+ }
+ }
+ else if ( !arguments.equals( other.arguments ) ) {
+ return false;
+ }
+ if ( methodName == null ) {
+ return other.methodName == null;
+ }
+ else {
+ return methodName.equals( other.methodName );
+ }
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Qualified.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Qualified.java
new file mode 100644
index 0000000..e067ca7
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Qualified.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks;
+
+import org.mapstruct.Qualifier;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+@Qualifier
+public @interface Qualified {
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Source.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Source.java
new file mode 100644
index 0000000..a650a39
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Source.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.callbacks;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+/**
+ * @author Andreas Gudian
+ */
+@AutoMapper(target = Target.class, uses = {ClassContainingCallbacks.class, BaseMapper.class})
+public class Source {
+ private String foo;
+
+ public String getFoo() {
+ return foo;
+ }
+
+ public void setFoo(String foo) {
+ this.foo = foo;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((foo == null) ? 0 : foo.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Source other = (Source) obj;
+ if (foo == null) {
+ return other.foo == null;
+ } else {
+ return foo.equals(other.foo);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Source [foo=" + foo + "]";
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/SourceEnum.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/SourceEnum.java
new file mode 100644
index 0000000..8746050
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/SourceEnum.java
@@ -0,0 +1,14 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+public enum SourceEnum {
+ A, B, C;
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Target.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Target.java
new file mode 100644
index 0000000..20c1019
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/Target.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks;
+
+/**
+ * @author Andreas Gudian
+ */
+public class Target {
+ private String foo;
+
+ public String getFoo() {
+ return foo;
+ }
+
+ public void setFoo(String foo) {
+ this.foo = foo;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ( ( foo == null ) ? 0 : foo.hashCode() );
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( this == obj ) {
+ return true;
+ }
+ if ( obj == null ) {
+ return false;
+ }
+ if ( getClass() != obj.getClass() ) {
+ return false;
+ }
+ Target other = (Target) obj;
+ if ( foo == null ) {
+ return other.foo == null;
+ }
+ else {
+ return foo.equals( other.foo );
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "Target [foo=" + foo + "]";
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/TargetEnum.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/TargetEnum.java
new file mode 100644
index 0000000..c98141d
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/TargetEnum.java
@@ -0,0 +1,14 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+public enum TargetEnum {
+ A, B, C;
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Address.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Address.java
new file mode 100644
index 0000000..342f1dd
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Address.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.callbacks.ongeneratedmethods;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+ * @author Sjaak Derksen
+ */
+@AutoMapper(target = AddressDto.class, unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = CompanyMapperPostProcessing.class)
+public class Address {
+
+ private String addressLine;
+ private String town;
+
+ public String getAddressLine() {
+ return addressLine;
+ }
+
+ public void setAddressLine(String addressLine) {
+ this.addressLine = addressLine;
+ }
+
+ public String getTown() {
+ return town;
+ }
+
+ public void setTown(String town) {
+ this.town = town;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/AddressDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/AddressDto.java
new file mode 100644
index 0000000..73533f3
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/AddressDto.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks.ongeneratedmethods;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+public class AddressDto {
+
+ private int houseNumber;
+ private String street;
+ private String town;
+
+ public int getHouseNumber() {
+ return houseNumber;
+ }
+
+ public void setHouseNumber( int houseNumber ) {
+ this.houseNumber = houseNumber;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet( String street ) {
+ this.street = street;
+ }
+
+ public String getTown() {
+ return town;
+ }
+
+ public void setTown( String town ) {
+ this.town = town;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Company.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Company.java
new file mode 100644
index 0000000..cc0706e
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Company.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.callbacks.ongeneratedmethods;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import java.util.List;
+import org.mapstruct.ReportingPolicy;
+
+/**
+ * @author Sjaak Derksen
+ */
+@AutoMapper(target = CompanyDto.class, unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = CompanyMapperPostProcessing.class)
+public class Company {
+
+ private List employees;
+
+ public List getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees(List employees) {
+ this.employees = employees;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/CompanyDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/CompanyDto.java
new file mode 100644
index 0000000..5e94b72
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/CompanyDto.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks.ongeneratedmethods;
+
+import java.util.List;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+public class CompanyDto {
+
+ private List employees;
+
+ public List getEmployees() {
+ return employees;
+ }
+
+ public void setEmployees( List employees ) {
+ this.employees = employees;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/CompanyMapperPostProcessing.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/CompanyMapperPostProcessing.java
new file mode 100644
index 0000000..ededd66
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/CompanyMapperPostProcessing.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks.ongeneratedmethods;
+
+import org.mapstruct.AfterMapping;
+import org.mapstruct.MappingTarget;
+import org.springframework.stereotype.Component;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+@Component
+public class CompanyMapperPostProcessing {
+
+ @AfterMapping
+ public void toAddressDto(Address address, @MappingTarget AddressDto addressDto) {
+ String addressLine = address.getAddressLine();
+ int separatorIndex = addressLine.indexOf( ";" );
+ addressDto.setStreet( addressLine.substring( 0, separatorIndex ) );
+ String houseNumber = addressLine.substring( separatorIndex + 1 );
+ addressDto.setHouseNumber( Integer.parseInt( houseNumber ) );
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Employee.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Employee.java
new file mode 100644
index 0000000..b6011a5
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/Employee.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.callbacks.ongeneratedmethods;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import org.mapstruct.ReportingPolicy;
+
+/**
+ * @author Sjaak Derksen
+ */
+@AutoMapper(target = EmployeeDto.class, unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = CompanyMapperPostProcessing.class, mapperNameSuffix = "$1")
+public class Employee {
+
+ private Address address;
+
+ public Address getAddress() {
+ return address;
+ }
+
+ public void setAddress(Address address) {
+ this.address = address;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/EmployeeDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/EmployeeDto.java
new file mode 100644
index 0000000..197a6bc
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/ongeneratedmethods/EmployeeDto.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.callbacks.ongeneratedmethods;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+public class EmployeeDto {
+
+ private AddressDto address;
+
+ public AddressDto getAddress() {
+ return address;
+ }
+
+ public void setAddress( AddressDto address ) {
+ this.address = address;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarDto.java
new file mode 100644
index 0000000..b727fdb
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarDto.java
@@ -0,0 +1,16 @@
+package io.github.linpeilie.me.callbacks.typematching;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+@AutoMapper(target = CarEntity.class, uses = CarMapper.class)
+public class CarDto extends Identifiable {
+ private int seatCount;
+
+ public int getSeatCount() {
+ return seatCount;
+ }
+
+ public void setSeatCount(int seatCount) {
+ this.seatCount = seatCount;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarEntity.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarEntity.java
new file mode 100644
index 0000000..b84e95b
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarEntity.java
@@ -0,0 +1,13 @@
+package io.github.linpeilie.me.callbacks.typematching;
+
+public class CarEntity extends Identifiable {
+ private int seatCount;
+
+ public int getSeatCount() {
+ return seatCount;
+ }
+
+ public void setSeatCount(int seatCount) {
+ this.seatCount = seatCount;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarMapper.java
new file mode 100644
index 0000000..e8b8fa2
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/CarMapper.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.callbacks.typematching;
+
+import org.mapstruct.AfterMapping;
+import org.mapstruct.BeforeMapping;
+import org.mapstruct.MappingTarget;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Andreas Gudian
+ */
+@Component
+public class CarMapper {
+
+ @AfterMapping
+ protected void neverMatched(ElectricCarDto electricDto) {
+ throw new RuntimeException("must not be called");
+ }
+
+ @AfterMapping
+ protected void neverMatched(@MappingTarget ElectricCarEntity electricEntity) {
+ throw new RuntimeException("must not be called");
+ }
+
+ @AfterMapping
+ protected void isCalled(@MappingTarget Object any) {
+ if (any instanceof CarEntity) {
+ CarEntity car = (CarEntity) any;
+ if (car.getSeatCount() == 0) {
+ car.setSeatCount(5);
+ }
+ }
+ }
+
+ @AfterMapping
+ protected void incrementsTargetId(@MappingTarget Identifiable identifiable) {
+ identifiable.setId(identifiable.getId() + 1);
+ }
+
+ @BeforeMapping
+ protected void incrementsSourceId(Identifiable identifiable) {
+ identifiable.setId(identifiable.getId() + 1);
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/ElectricCarDto.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/ElectricCarDto.java
new file mode 100644
index 0000000..988d99f
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/ElectricCarDto.java
@@ -0,0 +1,13 @@
+package io.github.linpeilie.me.callbacks.typematching;
+
+public class ElectricCarDto extends CarDto {
+ private long batteryCapacity;
+
+ public long getBatteryCapacity() {
+ return batteryCapacity;
+ }
+
+ public void setBatteryCapacity(long batteryCapacity) {
+ this.batteryCapacity = batteryCapacity;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/ElectricCarEntity.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/ElectricCarEntity.java
new file mode 100644
index 0000000..d597152
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/ElectricCarEntity.java
@@ -0,0 +1,13 @@
+package io.github.linpeilie.me.callbacks.typematching;
+
+public class ElectricCarEntity extends Identifiable {
+ private long batteryCapacity;
+
+ public long getBatteryCapacity() {
+ return batteryCapacity;
+ }
+
+ public void setBatteryCapacity(long batteryCapacity) {
+ this.batteryCapacity = batteryCapacity;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/Identifiable.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/Identifiable.java
new file mode 100644
index 0000000..98dcb4a
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/callbacks/typematching/Identifiable.java
@@ -0,0 +1,13 @@
+package io.github.linpeilie.me.callbacks.typematching;
+
+public abstract class Identifiable {
+ private long id;
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Colour.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Colour.java
new file mode 100644
index 0000000..1e71dff
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Colour.java
@@ -0,0 +1,10 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+public enum Colour {
+ RED, GREEN, BLUE;
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Source.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Source.java
new file mode 100644
index 0000000..54bba0b
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Source.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMapping;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+@AutoMapper(target = Target.class, uses = SourceTargetMapper.class)
+public class Source {
+
+ private List publicStringList;
+
+ private List stringList;
+ private List otherStringList;
+ private ArrayList stringArrayList;
+
+ private Set stringSet;
+ private HashSet stringHashSet;
+
+ private Collection stringCollection;
+
+ @AutoMapping(target = "integerCollection")
+ private List integerList;
+
+ @AutoMapping(target = "set")
+ private Set integerSet;
+
+ @AutoMapping(target = "anotherStringSet")
+ private Set anotherIntegerSet;
+
+ private Set colours;
+
+ private Map stringLongMap;
+
+ private Map otherStringLongMap;
+
+ @AutoMapping(target = "nonGenericMapStringtoLong")
+ private Map stringLongMapForNonGeneric;
+
+ @AutoMapping(target = "stringListNoSetter")
+ private List stringList2;
+
+ @AutoMapping(target = "stringListNoSetter2")
+ private Set stringSet2;
+
+ private EnumSet enumSet;
+
+ @AutoMapping(target = "nonGenericStringList")
+ private List stringList3;
+
+ public List getPublicStringList() {
+ return publicStringList;
+ }
+
+ public void setPublicStringList(List publicStringList) {
+ this.publicStringList = publicStringList;
+ }
+
+ public List getStringList() {
+ return stringList;
+ }
+
+ public void setStringList(List stringList) {
+ this.stringList = stringList;
+ }
+
+ public ArrayList getStringArrayList() {
+ return stringArrayList;
+ }
+
+ public void setStringArrayList(ArrayList stringArrayList) {
+ this.stringArrayList = stringArrayList;
+ }
+
+ public Set getStringSet() {
+ return stringSet;
+ }
+
+ public void setStringSet(Set stringSet) {
+ this.stringSet = stringSet;
+ }
+
+ public HashSet getStringHashSet() {
+ return stringHashSet;
+ }
+
+ public void setStringHashSet(HashSet stringHashSet) {
+ this.stringHashSet = stringHashSet;
+ }
+
+ public Collection getStringCollection() {
+ return stringCollection;
+ }
+
+ public void setStringCollection(Collection stringCollection) {
+ this.stringCollection = stringCollection;
+ }
+
+ public List getIntegerList() {
+ return integerList;
+ }
+
+ public void setIntegerList(List integerList) {
+ this.integerList = integerList;
+ }
+
+ public Set getIntegerSet() {
+ return integerSet;
+ }
+
+ public void setIntegerSet(Set integerSet) {
+ this.integerSet = integerSet;
+ }
+
+ public Set getAnotherIntegerSet() {
+ return anotherIntegerSet;
+ }
+
+ public void setAnotherIntegerSet(Set anotherIntegerSet) {
+ this.anotherIntegerSet = anotherIntegerSet;
+ }
+
+ public Set getColours() {
+ return colours;
+ }
+
+ public void setColours(Set colours) {
+ this.colours = colours;
+ }
+
+ public Map getStringLongMap() {
+ return stringLongMap;
+ }
+
+ public void setStringLongMap(Map stringLongMap) {
+ this.stringLongMap = stringLongMap;
+ }
+
+ public List getStringList2() {
+ return stringList2;
+ }
+
+ public void setStringList2(List stringList2) {
+ this.stringList2 = stringList2;
+ }
+
+ public List getOtherStringList() {
+ return otherStringList;
+ }
+
+ public void setOtherStringList(List otherStringList) {
+ this.otherStringList = otherStringList;
+ }
+
+ public Map getOtherStringLongMap() {
+ return otherStringLongMap;
+ }
+
+ public void setOtherStringLongMap(Map otherStringLongMap) {
+ this.otherStringLongMap = otherStringLongMap;
+ }
+
+ public Set getStringSet2() {
+ return stringSet2;
+ }
+
+ public void setStringSet2(Set stringSet2) {
+ this.stringSet2 = stringSet2;
+ }
+
+ public EnumSet getEnumSet() {
+ return enumSet;
+ }
+
+ public void setEnumSet(EnumSet enumSet) {
+ this.enumSet = enumSet;
+ }
+
+ public List getStringList3() {
+ return stringList3;
+ }
+
+ public void setStringList3(List stringList3) {
+ this.stringList3 = stringList3;
+ }
+
+ public Map getStringLongMapForNonGeneric() {
+ return stringLongMapForNonGeneric;
+ }
+
+ public void setStringLongMapForNonGeneric(Map stringLongMapForNonGeneric) {
+ this.stringLongMapForNonGeneric = stringLongMapForNonGeneric;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/SourceTargetMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/SourceTargetMapper.java
new file mode 100644
index 0000000..5137f3a
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/SourceTargetMapper.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class SourceTargetMapper {
+
+ protected StringHolder toStringHolder(String string) {
+ return new StringHolder( string );
+ }
+
+ protected String toString(StringHolder string) {
+ return string.getString();
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolder.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolder.java
new file mode 100644
index 0000000..88860e1
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolder.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+public class StringHolder {
+ private final String string;
+
+ public StringHolder(String string) {
+ this.string = string;
+ }
+
+ public String getString() {
+ return string;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ( ( string == null ) ? 0 : string.hashCode() );
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if ( this == obj ) {
+ return true;
+ }
+ if ( obj == null ) {
+ return false;
+ }
+ if ( getClass() != obj.getClass() ) {
+ return false;
+ }
+ StringHolder other = (StringHolder) obj;
+ if ( string == null ) {
+ return other.string == null;
+ }
+ else {
+ return string.equals( other.string );
+ }
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolderArrayList.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolderArrayList.java
new file mode 100644
index 0000000..c19ebe0
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolderArrayList.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+import java.util.ArrayList;
+
+/**
+ * @author Stefan May
+ */
+public class StringHolderArrayList extends ArrayList {
+
+ private static final long serialVersionUID = 1L;
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolderToLongMap.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolderToLongMap.java
new file mode 100644
index 0000000..4a0e941
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/StringHolderToLongMap.java
@@ -0,0 +1,17 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+import java.util.HashMap;
+
+/**
+ * @author Stefan May
+ */
+public class StringHolderToLongMap extends HashMap {
+
+ private static final long serialVersionUID = 1L;
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Target.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Target.java
new file mode 100644
index 0000000..96e4158
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/Target.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class Target {
+
+ //CHECKSTYLE:OFF
+ public List publicStringList;
+ //CHECKSTYLE:On
+
+ private List stringList;
+ private List otherStringList;
+ private ArrayList stringArrayList;
+
+ private Set stringSet;
+ private HashSet stringHashSet;
+
+ private Collection stringCollection;
+
+ private Collection integerCollection;
+
+ private Set anotherStringSet;
+
+ private Set colours;
+
+ private Map stringLongMap;
+ private Map otherStringLongMap;
+
+ private List stringListNoSetter;
+
+ private List stringListNoSetter2;
+
+ @SuppressWarnings( "rawtypes" )
+ private Set set;
+
+ private EnumSet enumSet;
+
+ private StringHolderArrayList nonGenericStringList;
+
+ private StringHolderToLongMap nonGenericMapStringtoLong;
+
+ public Target() {
+ otherStringLongMap = new HashMap<>();
+ otherStringLongMap.put( "not-present-after-mapping", 42L );
+
+ otherStringList = new ArrayList<>();
+ otherStringList.add( "not-present-after-mapping" );
+ }
+
+ public List getStringList() {
+ return stringList;
+ }
+
+ public void setStringList(List stringList) {
+ this.stringList = stringList;
+ }
+
+ public ArrayList getStringArrayList() {
+ return stringArrayList;
+ }
+
+ public void setStringArrayList(ArrayList stringArrayList) {
+ this.stringArrayList = stringArrayList;
+ }
+
+ public Set getStringSet() {
+ return stringSet;
+ }
+
+ public void setStringSet(Set stringSet) {
+ this.stringSet = stringSet;
+ }
+
+ public HashSet getStringHashSet() {
+ return stringHashSet;
+ }
+
+ public void setStringHashSet(HashSet stringHashSet) {
+ this.stringHashSet = stringHashSet;
+ }
+
+ public Collection getStringCollection() {
+ return stringCollection;
+ }
+
+ public void setStringCollection(Collection stringCollection) {
+ this.stringCollection = stringCollection;
+ }
+
+ public Collection getIntegerCollection() {
+ return integerCollection;
+ }
+
+ public void setIntegerCollection(Collection integerCollection) {
+ this.integerCollection = integerCollection;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Set getSet() {
+ return set;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void setSet(Set set) {
+ this.set = set;
+ }
+
+ public Set getAnotherStringSet() {
+ return anotherStringSet;
+ }
+
+ public void setAnotherStringSet(Set anotherStringSet) {
+ this.anotherStringSet = anotherStringSet;
+ }
+
+ public void setColours(Set colours) {
+ this.colours = colours;
+ }
+
+ public Set getColours() {
+ return colours;
+ }
+
+ public Map getStringLongMap() {
+ return stringLongMap;
+ }
+
+ public void setStringLongMap(Map stringLongMap) {
+ this.stringLongMap = stringLongMap;
+ }
+
+ public List getStringListNoSetter() {
+ if ( stringListNoSetter == null ) {
+ stringListNoSetter = new ArrayList<>();
+ }
+ return stringListNoSetter;
+ }
+
+ public List getStringListNoSetter2() {
+ if ( stringListNoSetter2 == null ) {
+ stringListNoSetter2 = new ArrayList<>();
+ }
+ return stringListNoSetter2;
+ }
+
+ public Map getOtherStringLongMap() {
+ return otherStringLongMap;
+ }
+
+ public void setOtherStringLongMap(Map otherStringLongMap) {
+ this.otherStringLongMap = otherStringLongMap;
+ }
+
+ public List getOtherStringList() {
+ return otherStringList;
+ }
+
+ public void setOtherStringList(List otherStringList) {
+ this.otherStringList = otherStringList;
+ }
+
+ public EnumSet getEnumSet() {
+ return enumSet;
+ }
+
+ public void setEnumSet(EnumSet enumSet) {
+ this.enumSet = enumSet;
+ }
+
+ public StringHolderArrayList getNonGenericStringList() {
+ return nonGenericStringList;
+ }
+
+ public void setNonGenericStringList(StringHolderArrayList nonGenericStringList) {
+ this.nonGenericStringList = nonGenericStringList;
+ }
+
+ public StringHolderToLongMap getNonGenericMapStringtoLong() {
+ return nonGenericMapStringtoLong;
+ }
+
+ public void setNonGenericMapStringtoLong(StringHolderToLongMap nonGenericMapStringtoLong) {
+ this.nonGenericMapStringtoLong = nonGenericMapStringtoLong;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/TestList.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/TestList.java
new file mode 100644
index 0000000..663627e
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/TestList.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class TestList extends ArrayList {
+
+ private static final long serialVersionUID = 1L;
+
+ private static boolean addAllCalled = false;
+
+ public static boolean isAddAllCalled() {
+ return addAllCalled;
+ }
+
+ public static void setAddAllCalled(boolean addAllCalled) {
+ TestList.addAllCalled = addAllCalled;
+ }
+
+ @Override
+ public boolean addAll(Collection extends E> c) {
+ addAllCalled = true;
+ return super.addAll( c );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/TestMap.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/TestMap.java
new file mode 100644
index 0000000..341a4e5
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/TestMap.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class TestMap extends HashMap {
+
+ private static final long serialVersionUID = 1L;
+
+ private static boolean puttAllCalled = false;
+
+ public static boolean isPuttAllCalled() {
+ return puttAllCalled;
+ }
+
+ public static void setPuttAllCalled(boolean puttAllCalled) {
+ TestMap.puttAllCalled = puttAllCalled;
+ }
+
+ @Override
+ public void putAll(Map extends K, ? extends V> m) {
+ puttAllCalled = true;
+ super.putAll( m );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/CatException.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/CatException.java
new file mode 100644
index 0000000..54f3522
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/CatException.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class CatException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public CatException() {
+ }
+
+ public CatException(String msg) {
+ super( msg );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/DogException.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/DogException.java
new file mode 100644
index 0000000..391892c
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/DogException.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class DogException extends Exception {
+
+ private static final long serialVersionUID = 1L;
+
+ public DogException() {
+ }
+
+ public DogException(String msg) {
+ super( msg );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/PetMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/PetMapper.java
new file mode 100644
index 0000000..4935452
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/PetMapper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder;
+
+import com.google.common.collect.ImmutableMap;
+import io.github.linpeilie.me.collection.adder._target.IndoorPet;
+import io.github.linpeilie.me.collection.adder._target.OutdoorPet;
+import io.github.linpeilie.me.collection.adder._target.Pet;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.mapstruct.TargetType;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Sjaak Derksen
+ */
+@Component
+public class PetMapper {
+
+ private static final Map PETS_TO_TARGET = ImmutableMap.builder()
+ .put( "rabbit", 1L )
+ .put( "mouse", 2L ).build();
+
+ private static final Map PETS_TO_SOURCE = ImmutableMap.builder()
+ .put( 1L, "rabbit" )
+ .put( 2L, "mouse" )
+ .put( 3L, "cat" )
+ .put( 4L, "dog" ).build();
+
+ /**
+ * method to be used when using an adder
+ *
+ * @param pet
+ *
+ * @return
+ *
+ * @throws CatException
+ * @throws DogException
+ */
+ public Long toPet(String pet) throws CatException, DogException {
+ if ( "cat".equals( pet ) ) {
+ throw new CatException();
+ }
+ else if ( "dog".equals( pet ) ) {
+ throw new DogException();
+ }
+ return PETS_TO_TARGET.get( pet );
+ }
+
+ /**
+ * Method to be used when not using an adder
+ *
+ * @param pets
+ *
+ * @return
+ *
+ * @throws CatException
+ * @throws DogException
+ */
+ public List toPets(List pets) throws CatException, DogException {
+ List result = new ArrayList<>();
+ for ( String pet : pets ) {
+ result.add( toPet( pet ) );
+ }
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T toPet(String pet, @TargetType Class clazz) throws CatException, DogException {
+ if ( clazz == IndoorPet.class ) {
+ return (T) new IndoorPet( toPet( pet ) );
+ }
+ if ( clazz == OutdoorPet.class ) {
+ return (T) new OutdoorPet( toPet( pet ) );
+ }
+ return null;
+ }
+
+ public List toSourcePets(List pets) throws CatException, DogException {
+ List result = new ArrayList<>();
+ for ( Long pet : pets ) {
+ result.add( PETS_TO_SOURCE.get( pet ) );
+ }
+ return result;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/TeethMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/TeethMapper.java
new file mode 100644
index 0000000..94f0d3b
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/TeethMapper.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder;
+
+import com.google.common.collect.ImmutableMap;
+import java.util.Map;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author Sjaak Derksen
+ */
+@Component
+public class TeethMapper {
+
+ private static final Map TEETH = ImmutableMap.builder()
+ .put( "incisor", 1 )
+ .put( "canine", 2 )
+ .put( "moler", 3 ).build();
+
+ public Integer toTooth(String tooth) {
+ return TEETH.get( tooth );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/AdderUsageObserver.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/AdderUsageObserver.java
new file mode 100644
index 0000000..59992e4
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/AdderUsageObserver.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class AdderUsageObserver {
+
+ private AdderUsageObserver() {
+ }
+
+ private static boolean used = false;
+
+ public static boolean isUsed() {
+ return used;
+ }
+
+ public static void setUsed(boolean used) {
+ AdderUsageObserver.used = used;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/IndoorPet.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/IndoorPet.java
new file mode 100644
index 0000000..55ee799
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/IndoorPet.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class IndoorPet extends Pet {
+
+ private Long value;
+
+ public IndoorPet(Long value) {
+ this.value = value;
+ }
+
+ public Long getValue() {
+ return value;
+ }
+
+ public void setValue(Long value) {
+ this.value = value;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/OutdoorPet.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/OutdoorPet.java
new file mode 100644
index 0000000..908948d
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/OutdoorPet.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class OutdoorPet extends Pet {
+
+ private Long value;
+
+ public OutdoorPet(Long value) {
+ this.value = value;
+ }
+
+ public Long getValue() {
+ return value;
+ }
+
+ public void setValue(Long value) {
+ this.value = value;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Pet.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Pet.java
new file mode 100644
index 0000000..eeb4567
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Pet.java
@@ -0,0 +1,13 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class Pet {
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target.java
new file mode 100644
index 0000000..aea270c
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class Target {
+
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void setPets(List pets) {
+ this.pets = pets;
+ }
+
+ public void addCat(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public void addDog(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public void addPets(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public Long addPet(Long pet) {
+ AdderUsageObserver.setUsed( true );
+ if ( pets == null ) {
+ pets = new ArrayList<>();
+ }
+ pets.add( pet );
+ return pet;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target2.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target2.java
new file mode 100644
index 0000000..c78eaad
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target2.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import io.github.linpeilie.me.collection.adder.source.Foo;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+public class Target2 {
+
+ private List attributes = new ArrayList();
+
+ public Foo addAttribute( Foo foo ) {
+ attributes.add( foo );
+ return foo;
+ }
+
+ public List getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes( List attributes ) {
+ this.attributes = attributes;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target3.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target3.java
new file mode 100644
index 0000000..78b1007
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/Target3.java
@@ -0,0 +1,38 @@
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Target3 {
+
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void setPets(List pets) {
+ this.pets = pets;
+ }
+
+ public void addCat(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public void addDog(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public void addPets(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public Long addPet(Long pet) {
+ AdderUsageObserver.setUsed( true );
+ if ( pets == null ) {
+ pets = new ArrayList<>();
+ }
+ pets.add( pet );
+ return pet;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetDali.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetDali.java
new file mode 100644
index 0000000..2ce6081
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetDali.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class TargetDali {
+
+ private List teeth;
+
+ public List getTeeth() {
+ return teeth;
+ }
+
+ public void setTeeth(List teeth) {
+ this.teeth = teeth;
+ }
+
+ public void addTeeth(Integer tooth) {
+ AdderUsageObserver.setUsed( true );
+ if ( teeth == null ) {
+ teeth = new ArrayList<>();
+ }
+ teeth.add( tooth );
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetHuman.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetHuman.java
new file mode 100644
index 0000000..1050c13
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetHuman.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class TargetHuman {
+
+ private List teeth;
+
+ public List getTeeth() {
+ return teeth;
+ }
+
+ public void setTeeth(List teeth) {
+ this.teeth = teeth;
+ }
+
+ public void addTooth(Integer pet) {
+ AdderUsageObserver.setUsed( true );
+ if ( teeth == null ) {
+ teeth = new ArrayList<>();
+ }
+ teeth.add( pet );
+ }
+
+ public void addTeeth(Integer tooth) {
+ if ( teeth == null ) {
+ teeth = new ArrayList<>();
+ }
+ teeth.add( tooth );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetOnlyGetter.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetOnlyGetter.java
new file mode 100644
index 0000000..f885823
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetOnlyGetter.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class TargetOnlyGetter {
+
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void addCat(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public void addDog(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public void addPets(Long cat) {
+ // dummy method to test selection mechanism
+ }
+
+ public void addPet(Long pet) {
+ AdderUsageObserver.setUsed( true );
+ if ( pets == null ) {
+ pets = new ArrayList<>();
+ }
+ pets.add( pet );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetViaTargetType.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetViaTargetType.java
new file mode 100644
index 0000000..b7e83e3
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetViaTargetType.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class TargetViaTargetType {
+
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void setPets(List pets) {
+ this.pets = pets;
+ }
+
+ public void addPet(IndoorPet pet) {
+ AdderUsageObserver.setUsed( true );
+ if ( pets == null ) {
+ pets = new ArrayList<>();
+ }
+ pets.add( pet );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetWithAnimals.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetWithAnimals.java
new file mode 100644
index 0000000..f1c6e5a
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetWithAnimals.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Filip Hrisafov
+ */
+public class TargetWithAnimals {
+
+ private List animals = new ArrayList<>();
+
+ public List getAnimals() {
+ return animals;
+ }
+
+ public void setAnimals(List animals) {
+ this.animals = animals;
+ }
+
+ public void addAnimal(String animal) {
+ animals.add( animal );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetWithoutSetter.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetWithoutSetter.java
new file mode 100644
index 0000000..432e9a7
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/_target/TargetWithoutSetter.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder._target;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Sjaak Derksen
+ */
+public class TargetWithoutSetter {
+
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void addPet(Long pet) {
+ AdderUsageObserver.setUsed( true );
+ if ( pets == null ) {
+ pets = new ArrayList<>();
+ }
+ pets.add( pet );
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Foo.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Foo.java
new file mode 100644
index 0000000..b32bcc5
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Foo.java
@@ -0,0 +1,14 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.adder.source;
+
+/**
+ *
+ * @author Sjaak Derksen
+ */
+public class Foo {
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SingleElementSource.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SingleElementSource.java
new file mode 100644
index 0000000..2c8ecf2
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SingleElementSource.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.collection.adder.source;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMapping;
+import io.github.linpeilie.me.collection.adder.PetMapper;
+import io.github.linpeilie.me.collection.adder.TeethMapper;
+import io.github.linpeilie.me.collection.adder._target.Target;
+import org.mapstruct.CollectionMappingStrategy;
+import org.mapstruct.Mapping;
+
+/**
+ * @author Sjaak Derksen
+ */
+@AutoMapper(target = Target.class, reverseConvertGenerate = false, collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED, uses = {
+ PetMapper.class, TeethMapper.class})
+public class SingleElementSource {
+
+ @AutoMapping(target = "pets")
+ private String pet;
+
+ public String getPet() {
+ return pet;
+ }
+
+ public void setPet(String pet) {
+ this.pet = pet;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source.java
new file mode 100644
index 0000000..e229a4f
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.collection.adder.source;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMappers;
+import io.github.linpeilie.me.collection.adder.PetMapper;
+import io.github.linpeilie.me.collection.adder.TeethMapper;
+import io.github.linpeilie.me.collection.adder._target.Target;
+import io.github.linpeilie.me.collection.adder._target.TargetOnlyGetter;
+import io.github.linpeilie.me.collection.adder._target.TargetViaTargetType;
+import io.github.linpeilie.me.collection.adder._target.TargetWithoutSetter;
+import java.util.List;
+import org.mapstruct.CollectionMappingStrategy;
+
+/**
+ * @author Sjaak Derksen
+ */
+@AutoMappers({
+ @AutoMapper(target = Target.class, collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED, uses = {
+ PetMapper.class, TeethMapper.class}),
+ @AutoMapper(target = TargetOnlyGetter.class, collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED, uses = {
+ PetMapper.class, TeethMapper.class}),
+ @AutoMapper(target = TargetViaTargetType.class, collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED, uses = {
+ PetMapper.class, TeethMapper.class}, reverseConvertGenerate = false),
+ @AutoMapper(target = TargetWithoutSetter.class,
+ collectionMappingStrategy = CollectionMappingStrategy.SETTER_PREFERRED,
+ uses = {PetMapper.class}
+ )
+})
+public class Source {
+
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void setPets(List pets) {
+ this.pets = pets;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source2.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source2.java
new file mode 100644
index 0000000..aa98004
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source2.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.collection.adder.source;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.me.collection.adder._target.Target2;
+import java.util.List;
+import org.mapstruct.CollectionMappingStrategy;
+
+/**
+ * @author Sjaak Derksen
+ */
+@AutoMapper(target = Target2.class,
+ reverseConvertGenerate = false,
+ collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED)
+public class Source2 {
+
+ private List attributes;
+
+ public List getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(List attributes) {
+ this.attributes = attributes;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source3.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source3.java
new file mode 100644
index 0000000..d9d6068
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/Source3.java
@@ -0,0 +1,20 @@
+package io.github.linpeilie.me.collection.adder.source;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.me.collection.adder.PetMapper;
+import io.github.linpeilie.me.collection.adder._target.Target3;
+import java.util.List;
+
+@AutoMapper(target = Target3.class, uses = PetMapper.class)
+public class Source3 {
+
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void setPets(List pets) {
+ this.pets = pets;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SourceTeeth.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SourceTeeth.java
new file mode 100644
index 0000000..40af0a9
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SourceTeeth.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.collection.adder.source;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMappers;
+import io.github.linpeilie.me.collection.adder.PetMapper;
+import io.github.linpeilie.me.collection.adder.TeethMapper;
+import io.github.linpeilie.me.collection.adder._target.TargetDali;
+import io.github.linpeilie.me.collection.adder._target.TargetHuman;
+import java.util.List;
+import org.mapstruct.CollectionMappingStrategy;
+
+/**
+ * @author Sjaak Derksen
+ */
+@AutoMappers({
+ @AutoMapper(target = TargetDali.class, collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED,
+ uses = {PetMapper.class, TeethMapper.class}),
+ @AutoMapper(target = TargetHuman.class, collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED,
+ uses = {PetMapper.class, TeethMapper.class})
+})
+public class SourceTeeth {
+
+ private List teeth;
+
+ public List getTeeth() {
+ return teeth;
+ }
+
+ public void setTeeth(List teeth) {
+ this.teeth = teeth;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SourceWithPets.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SourceWithPets.java
new file mode 100644
index 0000000..4a7e684
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/adder/source/SourceWithPets.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+
+package io.github.linpeilie.me.collection.adder.source;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMapping;
+import io.github.linpeilie.me.collection.adder._target.TargetWithAnimals;
+import java.util.List;
+import org.mapstruct.CollectionMappingStrategy;
+import org.mapstruct.Mapping;
+
+/**
+ * @author Filip Hrisafov
+ */
+@AutoMapper(target = TargetWithAnimals.class, collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED)
+public class SourceWithPets {
+
+ @AutoMapping(target = "animals")
+ private List pets;
+
+ public List getPets() {
+ return pets;
+ }
+
+ public void setPets(List pets) {
+ this.pets = pets;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/NoSetterSource.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/NoSetterSource.java
new file mode 100644
index 0000000..6a77b9b
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/NoSetterSource.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.defaultimplementation;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMappers;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+@AutoMappers({
+ @AutoMapper(target = NoSetterTarget.class)
+})
+public class NoSetterSource {
+ private List listValues;
+ private Map mapValues;
+
+ public List getListValues() {
+ return listValues;
+ }
+
+ public void setListValues(List listValues) {
+ this.listValues = listValues;
+ }
+
+ public Map getMapValues() {
+ return mapValues;
+ }
+
+ public void setMapValues(Map mapValues) {
+ this.mapValues = mapValues;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/NoSetterTarget.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/NoSetterTarget.java
new file mode 100644
index 0000000..ff301c8
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/NoSetterTarget.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.defaultimplementation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Andreas Gudian
+ *
+ */
+public class NoSetterTarget {
+ private List listValues = new ArrayList();
+ private Map mapValues = new HashMap();
+
+ public List getListValues() {
+ return listValues;
+ }
+
+ public Map getMapValues() {
+ return mapValues;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/Source.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/Source.java
new file mode 100644
index 0000000..59bf333
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/Source.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.defaultimplementation;
+
+import io.github.linpeilie.annotations.AutoMapper;
+import io.github.linpeilie.annotations.AutoMappers;
+import io.github.linpeilie.annotations.AutoMapping;
+import java.util.List;
+import org.mapstruct.Mapping;
+
+@AutoMappers({
+ @AutoMapper(target = Target.class)
+})
+public class Source {
+
+ @AutoMapping(target = "fooListNoSetter")
+ private List fooList;
+
+ public List getFooList() {
+ return fooList;
+ }
+
+ public void setFooList(List fooList) {
+ this.fooList = fooList;
+ }
+
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/SourceFoo.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/SourceFoo.java
new file mode 100644
index 0000000..9976ebc
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/SourceFoo.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.defaultimplementation;
+
+import io.github.linpeilie.annotations.AutoMapper;
+
+@AutoMapper(target = TargetFoo.class)
+public class SourceFoo {
+
+ private String name;
+
+ public SourceFoo() {
+ }
+
+ public SourceFoo(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/Target.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/Target.java
new file mode 100644
index 0000000..c5d0442
--- /dev/null
+++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/collection/defaultimplementation/Target.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright MapStruct Authors.
+ *
+ * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
+ */
+package io.github.linpeilie.me.collection.defaultimplementation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Target {
+
+ private List