diff --git a/README.md b/README.md
index 822e00428d92bc30ad235063b17e026207716a79..996cc02d49275dfcbee22029ffcd24e7d3c7e112 100644
--- a/README.md
+++ b/README.md
@@ -188,7 +188,7 @@ public class User {
```xml
- 1.4.0
+ 1.4.1
diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts
index f0a6b10911f8ae81942ee0d2888c84dfda45dc10..a1f46d7695e066f36830afeba74f7807a4139c36 100644
--- a/docs/.vuepress/config.ts
+++ b/docs/.vuepress/config.ts
@@ -2,7 +2,9 @@ import { defineUserConfig } from "vuepress";
import type { DefaultThemeOptions } from "vuepress";
import recoTheme from "vuepress-theme-reco";
import { themeConfig } from './config/index'
-import { umamiAnalyticsPlugin } from 'vuepress-plugin-umami-analytics'
+import { sitemapPlugin } from '@vuepress/plugin-sitemap'
+import { webpackBundler } from '@vuepress/bundler-webpack'
+import { viteBundler } from '@vuepress/bundler-vite'
export default defineUserConfig({
locales: {
@@ -37,9 +39,9 @@ export default defineUserConfig({
}
},
plugins: [
- umamiAnalyticsPlugin({
- id: '50be7a94-e1d7-4d49-a8db-67b17acaa0b3',
- src: 'https://114.115.147.1/script.js'
- })
- ]
+ sitemapPlugin({
+ hostname: 'mapstruct.plus'
+ }),
+ ],
+ bundler: webpackBundler(),
});
diff --git a/docs/README.md b/docs/README.md
index c8ee02f3ad106cac9b4d1415346ec673792d8498..9334cd1c55ab08a8a4f329e81af2de85f80016f0 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -11,8 +11,8 @@ bannerBrand:
description: 可能是最简单最强大的Java Bean转换工具
tagline: Mapstruct Plus 是 Mapstruct 的增强工具,在 Mapstruct 的基础上,实现了自动生成 Mapper 接口的功能,并强化了部分功能,使 Java 类型转换更加便捷、优雅。
buttons:
- - { text: 快速开始, link: '/introduction/quick-start' }
- - { text: '常见问题', link: '/guide/faq', type: 'plain' }
+ - { text: 快速开始, link: '/introduction/quick-start.html' }
+ - { text: '常见问题', link: '/guide/faq.html', type: 'plain' }
socialLinks:
- { icon: 'LogoGithub', link: 'https://github.com/vuepress-reco/vuepress-theme-reco' }
isShowTitleInHome: true
@@ -62,18 +62,31 @@ footer:
io.github.linpeilie
mapstruct-plus-spring-boot-starter
- 1.4.0-R1
+ 1.4.1
```
- gradle
```groovy
-implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.0-R1'
+implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.1'
```
## 更新日志
+### 1.4.1
+
+- feat: `AutoMapper` 注解增加 `mapperNameSuffix` 属性,支持配置生成的转换接口名称增加后缀,默认规则下生成的反向转换接口同时生效;
+- feat : 适配 `Mapper` 注解的 `unmappedSourcePolicy`、`unmappedTargetPolicy`、`typeConversionPolicy`、`collectionMappingStrategy`、`nullValueMappingStrategy`、`nullValueIterableMappingStrategy`、`nullValuePropertyMappingStrategy`、`nullValueCheckStrategy`、`mappingControl` 属性;
+- feat : 适配 `Mapping` 注解的 `constant`、`qualifiedBy`、`nullValueCheckStrategy`、`nullValuePropertyMappingStrategy`、`mappingControl`;
+- feat : 适配 MapStruct 配置的 `typeConversionPolicy`、`collectionMappingStrategy`、`nullValueIterableMappingStrategy`、`nullValueMapMappingStrategy`、`nullValueCheckStrategy`、`mappingControl`、`unexpectedValueMappingException`、`suppressTimestampInGenerated` 属性;
+- fix : 适配同一个模块中同类不同包生成类名冲突的问题;
+- feat : `AutoMapping` 注解增加 `reverseConvertGenerate`,控制是否生成反向转换逻辑,适配更加复杂的应用场景;
+- fix : 修复 `targetClass` 同时配置父类和子类时,转换规则冲突的问题;
+- fix : 修复不同模块配置类、代理类类名冲突的问题;
+- feat : `AutoMapper` 增加 `useEnums` 属性,支持手动配置转换时需要的枚举,解决跨模块枚举无法自动转换的问题;
+- 优化转换接口生成逻辑;
+
### 1.4.0
- **优化复杂对象转换逻辑,占用元空间更小!性能更快!**
@@ -82,6 +95,12 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s
- [feature#63](https://github.com/linpeilie/mapstruct-plus/pull/63)`AutoMapping`、`ReverseAutoMapping` 支持 `qualifiedByName`、`conditionQualifiedByName` 和 `dependsOn` 属性
- [issue#I93Z2Z](https://gitee.com/easii/mapstruct-plus/issues/I93Z2Z)`AutoMappings` 支持配置在方法上面
+> 升级 1.4.0 注意事项:
+> - 1.4.0 及以后的版本,复杂对象比较依赖项目中生成的 `ConvertMapperAdapter`,
+> 在多模块下,由于类加载机制只会加载一个的原因,可能会导致 [`NoSuchMethodError`](/guide/faq.html) 的异常,
+> 当然,这个问题在之前也会有,几率可能低一些,所以多模块下,务必配置 `adapterPackage` 来避免该问题。
+> - Map 与对象的转换,还是依赖 hutool 中的类转换实现,如果需要该功能,需要额外引入 `hutool-core` 依赖包。
+
### 1.3.6
- 兼容内部类转换
@@ -89,12 +108,6 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s
- [issue#I8QPRO](https://gitee.com/easii/mapstruct-plus/issues/I8QPRO) : 框架自动生成的 AutoMapperConfig 和 AutoMapMapper 包和类名支持配置
- [issue#I8T7EF](https://gitee.com/easii/mapstruct-plus/issues/I8T7EF) : 支持在父类中配置的 AutoMapping 注解
-
-### 1.3.5
-
-- AutoMapping、ReverseAutoMapping 支持配置在方法上面;
-- AutoMapping、ReverseAutoMapping 支持 defaultExpression 和 conditionExpression 属性
-
……
## 代码仓库
diff --git a/docs/en/README.md b/docs/en/README.md
index 403c0b273f3d1c25528b60da3d99b5cbaccfae25..bbe6eaea2539e6318441c23ab57c608240e016ab 100644
--- a/docs/en/README.md
+++ b/docs/en/README.md
@@ -11,8 +11,8 @@ bannerBrand:
description: Probably the simplest and most powerful Java Bean transformation tool
tagline: MapStructPlus is an enhancement tool of MapStruct. On the basis of MapStruct, it realizes the function of automatically generating Mapper interface, and strengthens some functions, making Java type conversion more convenient and elegant.
buttons:
- - { text: Quick Start, link: '/en/introduction/quick-start' }
- - { text: 'FAQ', link: '/en/guide/faq', type: 'plain' }
+ - { text: Quick Start, link: '/en/introduction/quick-start.html' }
+ - { text: 'FAQ', link: '/en/guide/faq.html', type: 'plain' }
socialLinks:
- { icon: 'LogoGithub', link: 'https://github.com/vuepress-reco/vuepress-theme-reco' }
isShowTitleInHome: true
@@ -58,18 +58,37 @@ fotter:
io.github.linpeilie
mapstruct-plus-spring-boot-starter
- 1.4.0-R1
+ 1.4.0
```
- gradle
```groovy
-implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.0-R1'
+implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.0'
```
## Change Log
+### 1.4.1
+
+Sure, here is the translated update document:
+
+---
+
+### Updates
+
+- **feat**: Added the `mapperNameSuffix` attribute to the `AutoMapper` annotation. This supports adding a suffix to the generated conversion interface name, and the reverse conversion interface will be effective under the default rules.
+- **feat**: Adapted the `Mapper` annotation to support the following attributes: `unmappedSourcePolicy`, `unmappedTargetPolicy`, `typeConversionPolicy`, `collectionMappingStrategy`, `nullValueMappingStrategy`, `nullValueIterableMappingStrategy`, `nullValuePropertyMappingStrategy`, `nullValueCheckStrategy`, and `mappingControl`.
+- **feat**: Adapted the `Mapping` annotation to support the following attributes: `constant`, `qualifiedBy`, `nullValueCheckStrategy`, `nullValuePropertyMappingStrategy`, and `mappingControl`.
+- **feat**: Adapted MapStruct configuration to support the following attributes: `typeConversionPolicy`, `collectionMappingStrategy`, `nullValueIterableMappingStrategy`, `nullValueMapMappingStrategy`, `nullValueCheckStrategy`, `mappingControl`, `unexpectedValueMappingException`, and `suppressTimestampInGenerated`.
+- **fix**: Resolved the issue of class name conflicts generated in different packages within the same module.
+- **feat**: Added the `reverseConvertGenerate` attribute to the `AutoMapping` annotation to control whether to generate reverse conversion logic, adapting to more complex application scenarios.
+- **fix**: Fixed the issue of conversion rule conflicts when both parent and child classes are configured in `targetClass`.
+- **fix**: Resolved class name conflicts of configuration classes and proxy classes in different modules.
+- **feat**: Added the `useEnums` attribute to `AutoMapper`, supporting manual configuration of required enums for conversion, solving the issue of automatic conversion of enums across modules.
+- Optimized the logic for generating conversion interfaces.
+
### 1.4.0
- **Optimize complex object conversion logic, take up less meta-space! and faster!**
@@ -78,6 +97,14 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s
- [feature#63](https://github.com/linpeilie/mapstruct-plus/pull/63) `AutoMapping`、`ReverseAutoMapping` supports `qualifiedByName`,`conditionQualifiedByName`,and `dependsOn` properties.
- [issue#I93Z2Z](https://gitee.com/easii/mapstruct-plus/issues/I93Z2Z) `AutoMappings` supports configuration on methods.
+> Points to note for upgrading 1.4.0
+> - 1.4.0 and later versions, complex object comparisons reply on `ConvertMapperAdapter` generated in the project,
+ which may cause [`NoSuchMethodError`](/guide/faq.html) exceptions under multiple modules because the Class Loading mechanism
+ will load only one, of course, this problem has been around before, and the odds are probably lower,
+ so be sure to configure the `adapterPackage` to avoid this problem with multiple modules.
+> - Map to object conversions still rely on class conversions in hutool, and additional `hutool-core` dependencies need to be introduced if this
+ functionality is required.
+
### 1.3.6
- Compatible with internal class conversion.
@@ -85,11 +112,6 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s
- AutoMapperConfig and AutoMapMapperConfig package and class name generated automatically by the framework support configuration.
- Supports AutoMapping annotations configured in the parent class.
-### 1.3.5
-
-- `@AutoMapping`、`@ReversedAutoMapping` support is configured on top of methods.
-- `@AutoMapping`、`@ReverseAutoMapping` support the defaultExpression and conditionExpression properties
-
……
## Code Warehouse
diff --git a/docs/en/guide/configuration.md b/docs/en/guide/configuration.md
index 0eab1720e63d6aa656e056419572e90a9c03dc3a..6cc797049f68ec0901cf33a5260df96a026cd257 100644
--- a/docs/en/guide/configuration.md
+++ b/docs/en/guide/configuration.md
@@ -191,3 +191,91 @@ eg:
- **Type**:`String`
- **Default**:AutoMapMapperConfig
- **Compile Parameter**:`-Amapstruct.plus.autoMapMapperConfigClassName`
+
+### typeConversionPolicy
+
+> since `1.4.1`
+
+- **Description**:How lossy (narrowing) conversion, for instance: long to integer should be reported.
+- **Type**:`ReportingPolicy`
+- **Optional**:
+ - `IGNORE`
+ - `WARN`
+ - `ERROR`
+- **Default**:`IGNORE`
+- **Compile Parameter**:`-Amapstruct.plus.typeConversionPolicy`
+
+### collectionMappingStrategy
+
+> since `1.4.1`
+
+- **Description**:The strategy to be applied when propagating the value of collection-typed properties. By default, only JavaBeans accessor methods (setters or getters) will be used, but it is also possible to invoke a corresponding adder method for each element of the source collection (e. g. orderDto.
+- **Type**:`CollectionMappingStrategy`
+- **Optional**:
+ - `ACCESSOR_ONLY`
+ - `SETTER_PREFERRED`
+ - `ADDER_PREFERRED`
+ - `TARGET_IMMUTABLE`
+- **Default**:`ACCESSOR_ONLY`
+- **Compile Parameter**:`-Amapstruct.plus.collectionMappingStrategy`
+
+### nullValueIterableMappingStrategy
+
+> since `1.4.1`
+
+- **Description**:The strategy to be applied when null is passed as source argument value to an IterableMapping. If no strategy is configured, the strategy given via `nullValueMappingStrategy()` will be applied, using `NullValueMappingStrategy`.`RETURN_NULL` by default.
+- **Type**:`NullValueMappingStrategy`
+- **Optional**:
+ - `RETURN_NULL`
+ - `RETURN_DEFAULT`
+- **Default**:`RETURN_NULL`
+- **Compile Parameter**:`-Amapstruct.plus.nullValueIterableMappingStrategy`
+
+### nullValueMapMappingStrategy
+
+> since `1.4.1`
+
+- **Description**:he strategy to be applied when null is passed as source argument value to a MapMapping. If no strategy is configured, the strategy given via `nullValueMappingStrategy()` will be applied, using `NullValueMappingStrategy`.`RETURN_NULL` by default.
+- **Type**:`NullValueMappingStrategy`
+- **Optional**:
+ - `RETURN_NULL`
+ - `RETURN_DEFAULT`
+- **Default**:`RETURN_NULL`
+- **Compile Parameter**:`-Amapstruct.plus.nullValueMapMappingStrategy`
+
+### nullValueCheckStrategy
+
+> since `1.4.1`
+
+- **Description**:Determines when to include a null check on the source property value of a bean mapping.
+- **Type**:`NullValueCheckStrategy`
+- **Optional**:
+ - `ON_IMPLICIT_CONVERSION`
+ - `ALWAYS`
+- **Default**:`ON_IMPLICIT_CONVERSION`
+- **Compile Parameter**:`-Amapstruct.plus.nullValueCheckStrategy`
+
+### mappingControl
+
+> since `1.4.1`
+
+- **Description**:Allows detailed control over the mapping process.
+- **Type**:`Class`
+- **Default**:`MappingControl.class`
+
+### unexpectedValueMappingException
+
+> since `1.4.1`
+
+- **Description**:Exception that should be thrown by the generated code if no mapping matches for enums. If no exception is configured, IllegalArgumentException will be used by default.
+- **Type**:`Class`
+- **Default**:`IllegalArgumentException.class`
+
+### suppressTimestampInGenerated
+
+> since `1.4.1`
+
+- **Description**:Flag indicating whether the addition of a time stamp in the @Generated annotation should be suppressed. i. e. not be added. The method overrides the flag set through an annotation processor option.
+- **Type**:`boolean`
+- **Default**:`false`
+- **Compile Parameter**:`-Amapstruct.plus.suppressTimestampInGenerated`
\ No newline at end of file
diff --git a/docs/en/guide/enum-convert.md b/docs/en/guide/enum-convert.md
index a1ec42ebbe261d0a51a824f7fb2919e4d8a88edf..eea6aa79c65477d33e6d0b5817fbe29a7cf4d85d 100644
--- a/docs/en/guide/enum-convert.md
+++ b/docs/en/guide/enum-convert.md
@@ -75,3 +75,13 @@ public void enumMapTest() {
}
```
+### Cross-Module Support
+
+When enums and the types they are used with are not in the same module, they cannot be automatically converted and require specified dependency relationships.
+
+In the `AutoMapper` annotation, you can specify the enum class list needed for the current conversion relationship through the `useEnums` attribute. These enums need to be annotated with `AutoEnumMapper`.
+
+> This feature is supported starting from version 1.4.1.
+
+It is important to note that when two classes are in the same module, specification is not required, and they can be automatically converted. This feature mainly addresses the issue of inability to automatically convert between different modules.
+
diff --git a/docs/en/release/log.md b/docs/en/release/log.md
index 16e2c73c88907306c6d80e7e9d79a0924f81d52d..0a23155ef8cae3309f8a7ea343191fde61b56a97 100644
--- a/docs/en/release/log.md
+++ b/docs/en/release/log.md
@@ -6,6 +6,19 @@ category:
description: MapStructPlus release log
---
+### 1.4.1
+
+- **feat**: Added the `mapperNameSuffix` attribute to the `AutoMapper` annotation. This supports adding a suffix to the generated conversion interface name, and the reverse conversion interface will be effective under the default rules.
+- **feat**: Adapted the `Mapper` annotation to support the following attributes: `unmappedSourcePolicy`, `unmappedTargetPolicy`, `typeConversionPolicy`, `collectionMappingStrategy`, `nullValueMappingStrategy`, `nullValueIterableMappingStrategy`, `nullValuePropertyMappingStrategy`, `nullValueCheckStrategy`, and `mappingControl`.
+- **feat**: Adapted the `Mapping` annotation to support the following attributes: `constant`, `qualifiedBy`, `nullValueCheckStrategy`, `nullValuePropertyMappingStrategy`, and `mappingControl`.
+- **feat**: Adapted MapStruct configuration to support the following attributes: `typeConversionPolicy`, `collectionMappingStrategy`, `nullValueIterableMappingStrategy`, `nullValueMapMappingStrategy`, `nullValueCheckStrategy`, `mappingControl`, `unexpectedValueMappingException`, and `suppressTimestampInGenerated`.
+- **fix**: Resolved the issue of class name conflicts generated in different packages within the same module.
+- **feat**: Added the `reverseConvertGenerate` attribute to the `AutoMapping` annotation to control whether to generate reverse conversion logic, adapting to more complex application scenarios.
+- **fix**: Fixed the issue of conversion rule conflicts when both parent and child classes are configured in `targetClass`.
+- **fix**: Resolved class name conflicts of configuration classes and proxy classes in different modules.
+- **feat**: Added the `useEnums` attribute to `AutoMapper`, supporting manual configuration of required enums for conversion, solving the issue of automatic conversion of enums across modules.
+- Optimized the logic for generating conversion interfaces.
+
### 1.4.0
- **Optimize complex object conversion logic, take up less meta-space! and faster!**
@@ -14,6 +27,14 @@ description: MapStructPlus release log
- [feature#63](https://github.com/linpeilie/mapstruct-plus/pull/63) `AutoMapping`、`ReverseAutoMapping` supports `qualifiedByName`,`conditionQualifiedByName`,and `dependsOn` properties.
- [issue#I93Z2Z](https://gitee.com/easii/mapstruct-plus/issues/I93Z2Z) `AutoMappings` supports configuration on methods.
+> Points to note for upgrading 1.4.0
+> - 1.4.0 and later versions, complex object comparisons reply on `ConvertMapperAdapter` generated in the project,
+ which may cause [`NoSuchMethodError`](/guide/faq.html) exceptions under multiple modules because the Class Loading mechanism
+ will load only one, of course, this problem has been around before, and the odds are probably lower,
+ so be sure to configure the `adapterPackage` to avoid this problem with multiple modules.
+> - Map to object conversions still rely on class conversions in hutool, and additional `hutool-core` dependencies need to be introduced if this
+ functionality is required.
+
### 1.3.6
- Compatible with internal class conversion.
diff --git a/docs/guide/configuration.md b/docs/guide/configuration.md
index e24ee0eb972825787d362912670064cb48e77ba5..78f5080cbf166b9e5f574b366c3335e7c95a2c76 100644
--- a/docs/guide/configuration.md
+++ b/docs/guide/configuration.md
@@ -188,3 +188,91 @@ public class MapStructPlusConfiguration {
- **类型**:`String`
- **默认值**:AutoMapMapperConfig
- **对应编译参数**:`-Amapstruct.plus.autoMapMapperConfigClassName`
+
+### typeConversionPolicy
+
+> since `1.4.1`
+
+- **说明**:有损转换的处理策略,例如:long 转换为 int
+- **类型**:`ReportingPolicy`
+- **支持配置项**:
+ - `IGNORE`
+ - `WARN`
+ - `ERROR`
+- **默认值**:`IGNORE`
+- **对应编译参数**:`-Amapstruct.plus.typeConversionPolicy`
+
+### collectionMappingStrategy
+
+> since `1.4.1`
+
+- **说明**:转换列表集合属性时的策略。
+- **类型**:`CollectionMappingStrategy`
+- **支持配置项**:
+ - `ACCESSOR_ONLY`
+ - `SETTER_PREFERRED`
+ - `ADDER_PREFERRED`
+ - `TARGET_IMMUTABLE`
+- **默认值**:`ACCESSOR_ONLY`
+- **对应编译参数**:`-Amapstruct.plus.collectionMappingStrategy`
+
+### nullValueIterableMappingStrategy
+
+> since `1.4.1`
+
+- **说明**:当将 `null` 作为源参数值传递给 `IterableMapping` 时要应用的策略。如果未配置策略,则将应用通过 `nullValueMappingStrategy()` 给出的策略。
+- **类型**:`NullValueMappingStrategy`
+- **支持配置项**:
+ - `RETURN_NULL`
+ - `RETURN_DEFAULT`
+- **默认值**:`RETURN_NULL`
+- **对应编译参数**:`-Amapstruct.plus.nullValueIterableMappingStrategy`
+
+### nullValueMapMappingStrategy
+
+> since `1.4.1`
+
+- **说明**:当将 `null` 作为源参数值传递给 `MapMapping` 时要应用的策略。如果未配置策略,则将应用通过 `nullValueMappingStrategy()` 给出的策略。
+- **类型**:`NullValueMappingStrategy`
+- **支持配置项**:
+ - `RETURN_NULL`
+ - `RETURN_DEFAULT`
+- **默认值**:`RETURN_NULL`
+- **对应编译参数**:`-Amapstruct.plus.nullValueMapMappingStrategy`
+
+### nullValueCheckStrategy
+
+> since `1.4.1`
+
+- **说明**:确定何时对 bean 映射的源属性值进行 null 检查。
+- **类型**:`NullValueCheckStrategy`
+- **支持配置项**:
+ - `ON_IMPLICIT_CONVERSION`
+ - `ALWAYS`
+- **默认值**:`ON_IMPLICIT_CONVERSION`
+- **对应编译参数**:`-Amapstruct.plus.nullValueCheckStrategy`
+
+### mappingControl
+
+> since `1.4.1`
+
+- **说明**:允许对映射过程进行详细控制。
+- **类型**:`Class`
+- **默认值**:`MappingControl.class`
+
+### unexpectedValueMappingException
+
+> since `1.4.1`
+
+- **说明**:如果枚举没有匹配的映射,则生成的代码应抛出异常。如果没有配置异常,则默认使用 IllegalArgumentException 。
+- **类型**:`Class`
+- **默认值**:`IllegalArgumentException.class`
+
+### suppressTimestampInGenerated
+
+> since `1.4.1`
+
+- **说明**:标识是否应在 `@Generated` 注释中添加时间戳
+- **类型**:`boolean`
+- **默认值**:`false`
+- **对应编译参数**:`-Amapstruct.plus.suppressTimestampInGenerated`
\ No newline at end of file
diff --git a/docs/guide/enum-convert.md b/docs/guide/enum-convert.md
index bfef27a3b3c5383d048de01a2ecbcbd4e9f03d6b..72663881d63652527e67b19dc9bdac607e41898d 100644
--- a/docs/guide/enum-convert.md
+++ b/docs/guide/enum-convert.md
@@ -6,6 +6,8 @@ category:
description: MapStructPlus Map转为对象 map convert to class
---
+## 枚举自动转换
+
> 当前特性从 1.2.2 开始支持
当需要进行枚举转换时(例如枚举转换为编码值,或者由编码转换为枚举),可以在目标枚举添加 `@AutoEnumMapper` 注解,
@@ -73,3 +75,12 @@ public void enumMapTest() {
}
```
+## 跨模块支持
+
+当枚举与要使用的类型,不在同一个模块(module)中时,并不能自动转换,需要指定依赖关系。
+
+在 `AutoMapper` 注解中,可以通过属性 `useEnums` 来指定,当前转换关系,需要依赖的枚举类列表。这些枚举需要被 `AutoEnumMapper`注解。
+
+> 该特性从 1.4.1 开始支持
+
+需要注意的是,当两个类在同一个模块(module)中,无需指定,可以自动转换。当前特性主要解决跨模块之间不能自动转换的问题。
diff --git a/docs/release/log.md b/docs/release/log.md
index cf7dc5d6517be26006af87976682b8f2949f6fe0..9d2f9ad35721f9b1c1b23fbd235e41807b526133 100644
--- a/docs/release/log.md
+++ b/docs/release/log.md
@@ -6,6 +6,19 @@ category:
description: MapStructPlus release log
---
+### 1.4.1
+
+- feat: `AutoMapper` 注解增加 `mapperNameSuffix` 属性,支持配置生成的转换接口名称增加后缀,默认规则下生成的反向转换接口同时生效;
+- feat : 适配 `Mapper` 注解的 `unmappedSourcePolicy`、`unmappedTargetPolicy`、`typeConversionPolicy`、`collectionMappingStrategy`、`nullValueMappingStrategy`、`nullValueIterableMappingStrategy`、`nullValuePropertyMappingStrategy`、`nullValueCheckStrategy`、`mappingControl` 属性;
+- feat : 适配 `Mapping` 注解的 `constant`、`qualifiedBy`、`nullValueCheckStrategy`、`nullValuePropertyMappingStrategy`、`mappingControl`;
+- feat : 适配 MapStruct 配置的 `typeConversionPolicy`、`collectionMappingStrategy`、`nullValueIterableMappingStrategy`、`nullValueMapMappingStrategy`、`nullValueCheckStrategy`、`mappingControl`、`unexpectedValueMappingException`、`suppressTimestampInGenerated` 属性;
+- fix : 适配同一个模块中同类不同包生成类名冲突的问题;
+- feat : `AutoMapping` 注解增加 `reverseConvertGenerate`,控制是否生成反向转换逻辑,适配更加复杂的应用场景;
+- fix : 修复 `targetClass` 同时配置父类和子类时,转换规则冲突的问题;
+- fix : 修复不同模块配置类、代理类类名冲突的问题;
+- feat : `AutoMapper` 增加 `useEnums` 属性,支持手动配置转换时需要的枚举,解决跨模块枚举无法自动转换的问题;
+- 优化转换接口生成逻辑;
+
### 1.4.0
- **优化复杂对象转换逻辑,占用元空间更小!性能更快!**
@@ -14,6 +27,14 @@ description: MapStructPlus release log
- [feature#63](https://github.com/linpeilie/mapstruct-plus/pull/63)`AutoMapping`、`ReverseAutoMapping` 支持 `qualifiedByName`、`conditionQualifiedByName` 和 `dependsOn` 属性
- [issue#I93Z2Z](https://gitee.com/easii/mapstruct-plus/issues/I93Z2Z)`AutoMappings` 支持配置在方法上面
+
+> 升级 1.4.0 注意事项:
+> - 1.4.0 及以后的版本,复杂对象比较依赖项目中生成的 `ConvertMapperAdapter`,
+ 在多模块下,由于类加载机制只会加载一个的原因,可能会导致 [`NoSuchMethodError`](/guide/faq.html) 的异常,
+ 当然,这个问题在之前也会有,几率可能低一些,所以多模块下,务必配置 `adapterPackage` 来避免该问题。
+> - Map 与对象的转换,还是依赖 hutool 中的类转换实现,如果需要该功能,需要额外引入 `hutool-core` 依赖包。
+
+
### 1.3.6
- 兼容内部类转换
diff --git a/example/pom.xml b/example/pom.xml
index 40528dea800e170f8074f921048ac8c630cd49ed..af6efcbffd25eaa178dc3746fb8602cac7575781 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -18,9 +18,10 @@
UTF-8
1.5.1.Final
- 1.4.0
+ 1.4.1
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 81a92c8c0435d671e2e185371f4e50fd8a214baf..34776f9035ac196180372e68a48537ea8612868c 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 e9849a7e85bfce13687f9ee37b7e6e07813ab5c7..7e5302aa6d7fc5af639b7b33a808b7e7617b94f7 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 a30b35d9ad8246414531b49dfa67d822ea3c5908..3374568e256462a2c351c67c28e26107a41236b9 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 0000000000000000000000000000000000000000..3a7026001a30bba77fdfb014c3c88a6d611cebae
--- /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 0000000000000000000000000000000000000000..e503a504cec55b7f65d5b803f31c513aad517e24
--- /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 0000000000000000000000000000000000000000..cdc07a45c7a651251107bb2193bd8ef3767a9393
--- /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 0000000000000000000000000000000000000000..175e5daf369234f2e5359ebdac6701b5a7587e98
--- /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 0000000000000000000000000000000000000000..54948df466ed4d0f9788cd3f504c58a603387b70
--- /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 0000000000000000000000000000000000000000..0768d893f41288b2a77a97d386450a5d4f158d45
--- /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 0000000000000000000000000000000000000000..5389beb7fac76be5705d12ace72eb880e26b8975
--- /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 0000000000000000000000000000000000000000..e5f8f2e9ec6752425cb055fd9f80128ec3ab0348
--- /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 0000000000000000000000000000000000000000..6ed77d1437aa0445f25e72691589324c40c629e5
--- /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 0000000000000000000000000000000000000000..8385b8de2ee837c2dabc50c213955458879a749a
--- /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 0000000000000000000000000000000000000000..4d445ef595586088f20030154f692d25b41bf53f
--- /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 0000000000000000000000000000000000000000..b1048d32fe95cf9f503d870534cdc627232279be
--- /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 0000000000000000000000000000000000000000..43e765068e6611d95eb1eb4cf70252d2ba4f6117
--- /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 0000000000000000000000000000000000000000..c76df2e37e50d1c5af548bef06f6f9c718381962
--- /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 0000000000000000000000000000000000000000..3f3ff932335473ddcbc550f49159a955012706d5
--- /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 0000000000000000000000000000000000000000..3229f0e16c72e7d4da4189f5b7d3f7853f221330
--- /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 0000000000000000000000000000000000000000..6bf2ebc28378fabaf6dded911ebc68a8eefc1b81
--- /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 0000000000000000000000000000000000000000..8c3caeb12f37a0b18ae908f02b4dcf421c61635e
--- /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 0000000000000000000000000000000000000000..72a0af61640bf1fee1e4b90ff1cf2bca47d82055
--- /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 0000000000000000000000000000000000000000..74271fc8ba359423c0989d09e34f32ac71c2102b
--- /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 0000000000000000000000000000000000000000..088ec3459f6d02237e1a5077459a59ed32148776
--- /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 0000000000000000000000000000000000000000..2a7ae854836d4150ad7a21b2ccf6aceb6b9e39b7
--- /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 0000000000000000000000000000000000000000..06853314ffeb6866bbc8c7b39b312ca78d3918f9
--- /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 0000000000000000000000000000000000000000..bfa2a0bcfe43529660a9cf86527ecc498b2b282c
--- /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 0000000000000000000000000000000000000000..9da83844b8cd34da3acc4c9f1b3e7c4072496569
--- /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 0000000000000000000000000000000000000000..9e8173eda2e2530b1a9a93b36e0871ae544923e2
--- /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 0000000000000000000000000000000000000000..b441be016e9014f58b64ade59deffb82412f55bd
--- /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 0000000000000000000000000000000000000000..9a46e9423e66f1e85d4744f7e68b6d945ce23069
--- /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 0000000000000000000000000000000000000000..e067ca70ae3eb210c947472b7a3f580633381449
--- /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 0000000000000000000000000000000000000000..a650a39dbf4c58d8da0fe4c9f7e59499afe65c24
--- /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 0000000000000000000000000000000000000000..874605049678b8c2dc62e3ca25533e615f7d6398
--- /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 0000000000000000000000000000000000000000..20c10199a20abfba5c40f7006e5640f3a4a93519
--- /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 0000000000000000000000000000000000000000..c98141d3f31604fbfcb906567e19cd184b5db6d8
--- /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 0000000000000000000000000000000000000000..342f1ddb3c06c6c13b70ecfcca897442dcc1859f
--- /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 0000000000000000000000000000000000000000..73533f36591dda2ecec88406ba281b89cb2c7fa5
--- /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 0000000000000000000000000000000000000000..cc0706e6fa239dbad9b1774368ab22be02fbef7d
--- /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 0000000000000000000000000000000000000000..5e94b72353bfd27bc974b1f05515fa5e8ed9896c
--- /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 0000000000000000000000000000000000000000..ededd66b608c0eb63dddc8187273fdd97c2573ad
--- /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 0000000000000000000000000000000000000000..b6011a53c72647e95881923ee42505d350e0511d
--- /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 0000000000000000000000000000000000000000..197a6bc4d65e58271599cb67923a763d12ac332c
--- /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 0000000000000000000000000000000000000000..b727fdb37ba21420208ca913f29b878292968344
--- /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 0000000000000000000000000000000000000000..b84e95b207e17ca65dd343db2e8c06572db89e8f
--- /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 0000000000000000000000000000000000000000..e8b8fa2f1669faa809c812d3c1f26e7316622e7a
--- /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 0000000000000000000000000000000000000000..988d99f26732bafb9c01eb963c2703eca6ba8ef1
--- /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 0000000000000000000000000000000000000000..d597152241d9ab40a099ee1295267582b9e273fb
--- /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 0000000000000000000000000000000000000000..98dcb4aa10089c76add4454c5e673848c88342c1
--- /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 0000000000000000000000000000000000000000..1e71dfffa998d024b1404a53730e5ad7486b98c8
--- /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 0000000000000000000000000000000000000000..54bba0bf9c973c001fbbee6145ca78242968c848
--- /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 0000000000000000000000000000000000000000..5137f3a41c14086b072c07f20aede443057ad997
--- /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 0000000000000000000000000000000000000000..88860e17e1735b032dd577937e9051bc9a9a7e3d
--- /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 0000000000000000000000000000000000000000..c19ebe04bbd4fadc4c51b2c015507eab6bb84b1b
--- /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 0000000000000000000000000000000000000000..4a0e9418693567d7de0278a3f2060a2f9468b59e
--- /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 0000000000000000000000000000000000000000..96e41584f5dc42bde02a724b985e6ed93d97a5bc
--- /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 0000000000000000000000000000000000000000..663627e3ed9343d6b50f68d60f6f8181dca819cb
--- /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 0000000000000000000000000000000000000000..341a4e526165b44c0a025b14ff2840bfabb5756f
--- /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 0000000000000000000000000000000000000000..54f35229546af5df0c11edc38b125cb972de8478
--- /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 0000000000000000000000000000000000000000..391892ca2abb73bf1bfd05e8aa193355b0f6ae58
--- /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 0000000000000000000000000000000000000000..4935452cbb8e621c59439f5b17654de5feecd176
--- /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 0000000000000000000000000000000000000000..94f0d3bc30a589d8696edd12af557019245a6ad0
--- /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 0000000000000000000000000000000000000000..59992e4e2fb711afdabdeff20e733c70a24a4a6b
--- /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 0000000000000000000000000000000000000000..55ee799bd97d18684a2a89f15745428ed0312513
--- /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 0000000000000000000000000000000000000000..908948d3c27e6b5e14d396594e64b1a11bf78941
--- /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 0000000000000000000000000000000000000000..eeb456790ed10356352d511d1c423696cd8aabe3
--- /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 0000000000000000000000000000000000000000..aea270ce82913c02b5ed8b963035db69308ac2aa
--- /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 0000000000000000000000000000000000000000..c78eaadb080b4522b559364e62d5e5cf5576c1a4
--- /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 0000000000000000000000000000000000000000..78b1007f949b2533dbd524cf4589dcba53576cc3
--- /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 0000000000000000000000000000000000000000..2ce60814b80e2490421fa8d4cc2e9a9dadb3a70c
--- /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 0000000000000000000000000000000000000000..1050c13acbdbf1a4f6f05e535ab52521cc8f431c
--- /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 0000000000000000000000000000000000000000..f8858235e974c6a69ea09bc620bad4f90a2de73c
--- /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 0000000000000000000000000000000000000000..b7e83e3df646e9005ba8e9c6080c4be7e88cc575
--- /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 0000000000000000000000000000000000000000..f1c6e5a347b113963f580be356aeb6aadd991bba
--- /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 0000000000000000000000000000000000000000..432e9a7c6de152fff58327318dec90ad12dcd275
--- /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 0000000000000000000000000000000000000000..b32bcc5962dc0bc232d27120a2dd7f7e1fdd2e63
--- /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 0000000000000000000000000000000000000000..2c8ecf2c3bdac77f88e4085830843bf018dc1c24
--- /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 0000000000000000000000000000000000000000..e229a4fe6eec461481af6cf2083c12d7dca09676
--- /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 0000000000000000000000000000000000000000..aa980042e4bb4f21a940c7c6ecd648a6600fde57
--- /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 0000000000000000000000000000000000000000..d9d6068f3a0ca7674fba4b5740c75193366e59a6
--- /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 0000000000000000000000000000000000000000..40af0a9dc8e32fce87fefa0a7db2eef18895359a
--- /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 0000000000000000000000000000000000000000..4a7e6842d5f8fb12f3389c4ee83aa2ca6deb01f5
--- /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 0000000000000000000000000000000000000000..6a77b9b5bc125b819b7db53e1b724af11852f73c
--- /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 0000000000000000000000000000000000000000..ff301c8b4e39f289ba174a059a05686086d16069
--- /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 0000000000000000000000000000000000000000..59bf3334e1aa29a8896653a7886c0050e3c20801
--- /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 0000000000000000000000000000000000000000..9976ebcd1dfef25ae36acd519834a1ca8c6fcb3c
--- /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 0000000000000000000000000000000000000000..c5d0442a1da7d1c68639ae5b8741c9981be123d7
--- /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