diff --git a/README.md b/README.md index 5564159..77c24f4 100644 --- a/README.md +++ b/README.md @@ -192,7 +192,7 @@ public class User { ```xml - 1.4.8 + 1.5.0 diff --git a/docs/README.md b/docs/README.md index b9ccde3..89ec531 100644 --- a/docs/README.md +++ b/docs/README.md @@ -61,18 +61,28 @@ footer: io.github.linpeilie mapstruct-plus-spring-boot-starter - 1.4.8 + 1.5.0 ``` - gradle ```groovy -implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.8' +implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.5.0' ``` ## 更新日志 +### 1.5.0 + +- 升级 MapStruct 版本为 1.6.3 + - 升级注意事项:MapStruct 1.6 增加了一个 Breaking Changes,升级后可能会导致有不兼容,详情可见 MapStruct [升级日志](https://github.com/mapstruct/mapstruct/releases) + > 在 MapStruct 1.6 中,增加了对源参数(source parameters)进行存在性检查的支持。 + 这意味着,即使你只想直接将一个源参数映射到某个目标属性,也需要使用新的注解 `@SourceParameterCondition` 或 `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)` 来定义存在性检查方法。 +- Converter 支持 Consumer 函数接口 +- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper、AutoMapping、ReverseAutoMapping 支持重复配置 +- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : MapperConfig 添加 uses 属性以配置全局共享的自定义转换类 + ### 1.4.8 - 修复在 Vscode 软件中,默认使用 Eclipse jdt.core 环境下,生成的转换实现类冲突的问题; @@ -85,13 +95,6 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s - fix [#108](https://github.com/linpeilie/mapstruct-plus/issues/108) : SpringContextUtils#getBeanFactory 方法改为静态; - [pr](https://github.com/linpeilie/mapstruct-plus/pull/114) : 增加注解批量增加 `AutoMapping`、`AutoMappings`、`ReverseAutoMapping`、`ReverseAutoMappings` 特性; -### 1.4.5 - -- fix: 修复 `ReverseAutoMappings` 配置不生效的问题 - -### 1.4.4 - -- fix: 修复部分Spring版本下找不到类的问题 …… diff --git a/docs/en/README.md b/docs/en/README.md index 297338a..43d7fab 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -58,18 +58,25 @@ fotter: io.github.linpeilie mapstruct-plus-spring-boot-starter - 1.4.8 + 1.5.0 ``` - gradle ```groovy -implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.4.8' +implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-starter', version: '1.5.0' ``` ## Change Log +- Upgrade MapStruct version to 1.6.3 + - Upgrade Notice: MapStruct 1.6 introduced breaking changes. Upgrading may cause compatibility issues. Refer to the MapStruct [Release Notes for details.] (https://github.com/mapstruct/mapstruct/releases) + > In MapStruct 1.6, support for presence checks on source parameters was added. This means that even if you want to map a source parameter directly to a target property, you must now define the presence check method using the new `@SourceParameterCondition` annotation or `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)`. +- Converter now supports the Consumer functional interface +- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper, AutoMapping, and ReverseAutoMapping now support repeated configurations. +- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : Added the uses property to MapperConfig for configuring globally shared custom converter classes. + ### 1.4.8 - Fixed the issue where the generated conversion implementation class conflicted when using the default `Eclipse jdt.core` environment in Vscode; @@ -82,21 +89,6 @@ implementation group: 'io.github.linpeilie', name: 'mapstruct-plus-spring-boot-s - fix [#108](https://github.com/linpeilie/mapstruct-plus/issues/108) : SpringContextUtils#getBeanFactory method changes to static; - [PR](https://github.com/linpeilie/mapstruct-plus/pull/114) : increase annotation batch `AutoMapping`、`AutoMappings`、`ReverseAutoMapping`、`ReverseAutoMappings` features. - -### 1.4.5 - -- fix: fiexed an issue where the `ReverseAutoMapping` configuration did not take effect. - -### 1.4.4 - -- fix: fixed a problem with missing classes in some Spring release version. - -### 1.4.3 - -- **feat**: Added `spring-lazy` option to `ComponentModel` for lazy loading Spring Beans, resolving mutual dependency issues, and set this option as the default configuration. -- **fix**: Fixed the issue where the default configuration for `unmappedTargetPolicy` was not effective. -- **enhance**: Optimized IDEA local development build efficiency, reducing build time and metaspace usage to some extent.[Issue #89](https://github.com/linpeilie/mapstruct-plus/issues/89) - …… ## Code Warehouse diff --git a/docs/en/release/log.md b/docs/en/release/log.md index 3c3f5c2..99bebeb 100644 --- a/docs/en/release/log.md +++ b/docs/en/release/log.md @@ -6,6 +6,13 @@ category: description: MapStructPlus release log --- +- Upgrade MapStruct version to 1.6.3 + - Upgrade Notice: MapStruct 1.6 introduced breaking changes. Upgrading may cause compatibility issues. Refer to the MapStruct [Release Notes for details.] (https://github.com/mapstruct/mapstruct/releases) + > In MapStruct 1.6, support for presence checks on source parameters was added. This means that even if you want to map a source parameter directly to a target property, you must now define the presence check method using the new `@SourceParameterCondition` annotation or `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)`. +- Converter now supports the Consumer functional interface +- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper, AutoMapping, and ReverseAutoMapping now support repeated configurations. +- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : Added the uses property to MapperConfig for configuring globally shared custom converter classes. + ### 1.4.8 - Fixed the issue where the generated conversion implementation class conflicted when using the default `Eclipse jdt.core` environment in Vscode; diff --git a/docs/release/log.md b/docs/release/log.md index 52950ef..99763d8 100644 --- a/docs/release/log.md +++ b/docs/release/log.md @@ -6,6 +6,17 @@ category: description: MapStructPlus release log --- + +### 1.5.0 + +- 升级 MapStruct 版本为 1.6.3 + - 升级注意事项:MapStruct 1.6 增加了一个 Breaking Changes,升级后可能会导致有不兼容,详情可见 MapStruct [升级日志](https://github.com/mapstruct/mapstruct/releases) + > 在 MapStruct 1.6 中,增加了对源参数(source parameters)进行存在性检查的支持。 + 这意味着,即使你只想直接将一个源参数映射到某个目标属性,也需要使用新的注解 `@SourceParameterCondition` 或 `@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)` 来定义存在性检查方法。 +- Converter 支持 Consumer 函数接口 +- [pr133](https://github.com/linpeilie/mapstruct-plus/pull/133) : AutoMapper、AutoMapping、ReverseAutoMapping 支持重复配置 +- [pr141](https://github.com/linpeilie/mapstruct-plus/pull/141) : MapperConfig 添加 uses 属性以配置全局共享的自定义转换类 + ### 1.4.8 - 修复在 Vscode 软件中,默认使用 Eclipse jdt.core 环境下,生成的转换实现类冲突的问题; diff --git a/example/pom.xml b/example/pom.xml index b7883e0..1874484 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -17,8 +17,8 @@ UTF-8 - 1.5.1.Final - 1.4.8 + 1.6.3 + 1.5.0 1.18.22 5.8.26 32.1.3-jre diff --git a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/conditional/qualifier/ConditionalMethodWithSourceToTargetMapper.java b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/conditional/qualifier/ConditionalMethodWithSourceToTargetMapper.java index d2a32af..091e08f 100644 --- a/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/conditional/qualifier/ConditionalMethodWithSourceToTargetMapper.java +++ b/example/spring-boot-with-lombok/src/main/java/io/github/linpeilie/me/conditional/qualifier/ConditionalMethodWithSourceToTargetMapper.java @@ -10,6 +10,7 @@ import org.mapstruct.Condition; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Named; +import org.mapstruct.SourceParameterCondition; import org.mapstruct.factory.Mappers; import org.springframework.stereotype.Component; @@ -19,13 +20,13 @@ import org.springframework.stereotype.Component; @Component public class ConditionalMethodWithSourceToTargetMapper { - @Condition + @SourceParameterCondition @Named("mapCustomerFromOrder") public boolean mapCustomerFromOrder(OrderDTO orderDTO) { return orderDTO != null && (orderDTO.getCustomerName() != null || mapAddressFromOrder(orderDTO)); } - @Condition + @SourceParameterCondition @Named("mapAddressFromOrder") public boolean mapAddressFromOrder(OrderDTO orderDTO) { return orderDTO != null && (orderDTO.getLine1() != null || orderDTO.getLine2() != null); diff --git a/mapstruct-plus/src/main/java/io/github/linpeilie/Converter.java b/mapstruct-plus/src/main/java/io/github/linpeilie/Converter.java index 8796ae4..9347aa9 100644 --- a/mapstruct-plus/src/main/java/io/github/linpeilie/Converter.java +++ b/mapstruct-plus/src/main/java/io/github/linpeilie/Converter.java @@ -70,7 +70,7 @@ public class Converter { if (ObjectUtils.isNull(targetType)) { throw new ConvertException("targetType cannot be null"); } - Class sourceType = sourceList.getFirst().getClass(); + Class sourceType = sourceList.get(0).getClass(); BaseMapper mapper = (BaseMapper) converterFactory.getMapper(sourceType, targetType); if (ObjectUtils.isNull(mapper)) { throw new ConvertException("cannot find converter from " + sourceType.getSimpleName() + " to " + targetType.getSimpleName()); @@ -116,7 +116,7 @@ public class Converter { if (ObjectUtils.isNull(targetType)) { throw new ConvertException("targetType cannot be null"); } - Class sourceType = sourceList.getFirst().getClass(); + Class sourceType = sourceList.get(0).getClass(); BaseCycleAvoidingMapper mapper = (BaseCycleAvoidingMapper) converterFactory.getCycleAvoidingMapper(sourceType, targetType); if (ObjectUtils.isNull(mapper)) { throw new ConvertException("cannot find converter from " + sourceType.getSimpleName() + " to " + targetType.getSimpleName()); diff --git a/pom.xml b/pom.xml index 57c5cc2..8362eb5 100644 --- a/pom.xml +++ b/pom.xml @@ -18,11 +18,11 @@ - 1.4.8 + 1.5.0 8 8 UTF-8 - 1.5.5.Final + 1.6.3 1.0.0.Alpha3 5.8.26 https://github.com/linpeilie/mapstruct-plus.git