前言
版本说明
mapstruct = 1.3.1.Final
相关链接
- MapStruct 官网:https://mapstruct.org/
- MapStruct 官方文档:https://mapstruct.org/documentation/reference-guide/
- MapStruct maven 地址:https://mvnrepository.com/artifact/org.mapstruct/mapstruct
- MapStruct github 地址:https://github.com/mapstruct/mapstruct/
实战演练
pom 依赖
<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>top.simba1949</groupId><artifactId>map-struct-1.3.1.Final</artifactId><version>1.0-SNAPSHOT</version><dependencies><!-- https://mvnrepository.com/artifact/org.mapstruct/mapstruct --><dependency><groupId>org.mapstruct</groupId><artifactId>mapstruct</artifactId><version>1.3.1.Final</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.12</version></dependency></dependencies><build><plugins><!--https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding><annotationProcessorPaths><!--lombok 和 MapStruct 一起使用需要配置--><path><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.12</version></path><path><groupId>org.mapstruct</groupId><artifactId>mapstruct-processor</artifactId><version>1.3.1.Final</version></path></annotationProcessorPaths></configuration></plugin></plugins></build></project>
属性相同属性名相同
推荐使用 spring-beans
包中 BeanUtils.copyProperties(source, target);
DTO
packageproperty.same.name.same; importlombok.Data; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 10:26*/publicclassPropertySameAndNameSameDto { privateIntegerid; privateBooleanenable; privateBigDecimalprice; privateStringdesc; privateDateproduce; privateLocalDateTimebirthday; }
VO
packageproperty.same.name.same; importlombok.Data; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 10:25*/publicclassPropertySameAndNameSameVo { privateIntegerid; privateBooleanenable; privateBigDecimalprice; privateStringdesc; privateDateproduce; privateLocalDateTimebirthday; }
自定义映射器
packageproperty.same.name.same; importorg.mapstruct.Mapper; importorg.mapstruct.factory.Mappers; /*** @Mapper :自定义映射器* 属性相同,属性名相同* @author Anthony* @date 2020/9/11 10:26*/publicinterfacePropertySameAndNameSameMapper { PropertySameAndNameSameMapperINSTANCE=Mappers.getMapper(PropertySameAndNameSameMapper.class); /*** 对象转换* 当属性与目标实体对应项具有相同的名称时,它将隐式映射。* @param propertySameAndNameSameDto* @return*/PropertySameAndNameSameVodto2Vo(PropertySameAndNameSameDtopropertySameAndNameSameDto); }
单元测试
packageproperty.same.name.same; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 10:27*/publicclassPropertySameAndNameSameApplication { publicstaticvoidmain(String[] args) { PropertySameAndNameSameDtodto=newPropertySameAndNameSameDto(); dto.setId(1); dto.setEnable(true); dto.setDesc("desc"); dto.setPrice(BigDecimal.ONE); dto.setProduce(newDate()); dto.setBirthday(LocalDateTime.now()); PropertySameAndNameSameVovo=PropertySameAndNameSameMapper.INSTANCE.dto2Vo(dto); System.out.println(vo); } }
属性相同属性名不同
DTO
packageproperty.same.name.diff; importlombok.Data; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 13:54*/publicclassPropertySameAndNameDiffDto { privateIntegeridDto; privateBooleanenableDto; privateBigDecimalpriceDto; privateStringdescDto; privateDateproduceDto; privateLocalDateTimebirthdayDto; }
VO
packageproperty.same.name.diff; importlombok.Data; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 13:55*/publicclassPropertySameAndNameDiffVo { privateIntegeridVo; privateBooleanenableVo; privateBigDecimalpriceVo; privateStringdescVo; privateDateproduceVo; privateLocalDateTimebirthdayVo; }
自定义映射器
packageproperty.same.name.diff; importorg.mapstruct.Mapper; importorg.mapstruct.Mapping; importorg.mapstruct.factory.Mappers; /*** @Mapper :自定义映射器* 属性相同,属性名不相同* @author Anthony* @date 2020/9/11 13:55*/publicinterfacePropertySameAndNameDiffMapper { PropertySameAndNameDiffMapperINSTANCE=Mappers.getMapper(PropertySameAndNameDiffMapper.class); /*** 对象转换* 当属性与目标实体对应项具有相同的名称时,它将隐式映射。* 当属性与目标实体对应项名称不相同时,需要使用 @Mapping 显示映射* @param propertySameAndNameDiffDto* @return*/source="idDto", target="idVo") (source="enableDto", target="enableVo") (source="priceDto", target="priceVo") (source="descDto", target="descVo") (source="produceDto", target="produceVo") (source="birthdayDto", target="birthdayVo") (PropertySameAndNameDiffVodto2Vo(PropertySameAndNameDiffDtopropertySameAndNameDiffDto); }
单元测试
packageproperty.same.name.diff; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 13:54*/publicclassPropertySameAndNameDiffApplication { publicstaticvoidmain(String[] args) { PropertySameAndNameDiffDtodto=newPropertySameAndNameDiffDto(); dto.setIdDto(1); dto.setEnableDto(true); dto.setDescDto("desc"); dto.setPriceDto(BigDecimal.TEN); dto.setProduceDto(newDate()); dto.setBirthdayDto(LocalDateTime.now()); PropertySameAndNameDiffVovo=PropertySameAndNameDiffMapper.INSTANCE.dto2Vo(dto); System.out.println(vo); } }
属性不同
DTO
packageproperty.diff; importlombok.Data; /*** @author Anthony* @date 2020/9/11 14:10*/publicclassPropertyDiffDto { privateStringidDto; privateStringenableDto; privateStringpriceDto; privateIntegerdescDto; privateStringproduceDto; privateStringbirthdayDto; }
VO
packageproperty.diff; importlombok.Data; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 14:10*/publicclassPropertyDiffVo { privateIntegeridVo; privateBooleanenableVo; privateBigDecimalpriceVo; privateStringdescVo; privateDateproduceVo; privateLocalDateTimebirthdayVo; }
自定义映射器
packageproperty.diff; importorg.mapstruct.Mapper; importorg.mapstruct.Mapping; importorg.mapstruct.factory.Mappers; /*** @Mapper :自定义映射器* 属性不相同* @author Anthony* @date 2020/9/11 14:10*/publicinterfacePropertyDiffMapper { PropertyDiffMapperINSTANCE=Mappers.getMapper(PropertyDiffMapper.class); /*** 对象转换* 属性相同:当属性与目标实体对应项具有相同的名称时,它将隐式映射。* 属性相同:当属性与目标实体对应项名称不相同时,需要使用 @Mapping 显示映射** 属性不同:* 有特殊要求的,比如日期,@Mapping 添加属性 dateFormat,不满足要求的可以自定义解析* (假设 enable 1=true,0=false):按照自定义解析方式解析* 无特殊要求的,按照以下规则解析** Boolean.parseBoolean(..)* Integer.parseInt(..)** String.valueOf(..)** (new SimpleDateFormat("yyyy-MM-dd")).parse(..) : dateFormat = "yyyy-MM-dd"* LocalDateTime.parse(.., DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) :dateFormat = "yyyy-MM-dd HH:mm:ss"** new BigDecimal(..)** @param propertyDiffDto* @return*/source="idDto", target="idVo") (// 将 source 定义成 表达式expression="java(enableDto2Vo(propertyDiffDto.getEnableDto()))", target="enableVo") (source="priceDto", target="priceVo") (source="descDto", target="descVo") (// 需要添加日期格式化source="produceDto", target="produceVo", dateFormat="yyyy-MM-dd") (source="birthdayDto", target="birthdayVo", dateFormat="yyyy-MM-dd HH:mm:ss") (PropertyDiffVodto2Vo(PropertyDiffDtopropertyDiffDto); /*** 自定义 enableDto2Vo 解析* @param enableStr* @return*/defaultbooleanenableDto2Vo(StringenableStr){ if ("0".equals(enableStr)){ returnfalse; }elseif ("1".equals(enableStr)){ returntrue; }else { thrownewRuntimeException("无法解析:"+enableStr); } } }
单元测试
packageproperty.diff; /*** @author Anthony* @date 2020/9/11 14:10*/publicclassPropertyDiffApplication { publicstaticvoidmain(String[] args) { PropertyDiffDtodto=newPropertyDiffDto(); dto.setIdDto("1"); // 除了 true 其他都是 false:假设1=true,0=falsedto.setEnableDto("0"); dto.setPriceDto("6.66"); dto.setDescDto(1); dto.setProduceDto("2020-09-11"); dto.setBirthdayDto("2020-09-11 14:00:00"); PropertyDiffVovo=PropertyDiffMapper.INSTANCE.dto2Vo(dto); System.out.println(vo); } }
多个对象转为一个对象数据
DtoFirst
packagemulti.object; importlombok.Data; importjava.math.BigDecimal; /*** @author Anthony* @date 2020/9/11 15:30*/publicclassMultiObject2OneDtoFirst { privateStringidDto; privateIntegerageDto; privateBigDecimalpriceDto; }
DtoSecond
packagemulti.object; importlombok.Data; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 15:30*/publicclassMultiObject2OneDtoSecond { privateDatebirthdayDto; privateLocalDateTimelocalDateTimeDto; privateMultiObject2OneDtoDepthdepthDto; }
DtoSecond.depthDto
packagemulti.object; importlombok.Data; /*** @author Anthony* @date 2020/9/11 16:28*/publicclassMultiObject2OneDtoDepth { privateBooleanenableDto; }
VO
packagemulti.object; importlombok.Data; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 15:32*/publicclassMultiObject2OneVo { privateStringidVo; privateIntegerageVo; privateBigDecimalpriceVo; privateDatebirthdayVo; privateLocalDateTimelocalDateTimeVo; privateBooleanenableVo; }
自定义映射器
packagemulti.object; importorg.mapstruct.Mapper; importorg.mapstruct.Mapping; importorg.mapstruct.factory.Mappers; /*** @author Anthony* @date 2020/9/11 15:30*/publicinterfaceMultiObject2OneMapper { MultiObject2OneMapperINSTANCE=Mappers.getMapper(MultiObject2OneMapper.class); source="first.idDto", target="idVo") (source="first.ageDto", target="ageVo") (source="first.priceDto", target="priceVo") (source="second.birthdayDto", target="birthdayVo") (source="second.localDateTimeDto", target="localDateTimeVo") (source="second.depthDto.enableDto", target="enableVo") (MultiObject2OneVodto2Vo(MultiObject2OneDtoFirstfirst, MultiObject2OneDtoSecondsecond); }
单元测试
packagemulti.object; importjava.math.BigDecimal; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 15:29*/publicclassMultiObject2OneApplication { publicstaticvoidmain(String[] args) { MultiObject2OneDtoFirstfirst=newMultiObject2OneDtoFirst(); first.setIdDto("id"); first.setAgeDto(18); first.setPriceDto(BigDecimal.TEN); MultiObject2OneDtoDepthdepth=newMultiObject2OneDtoDepth(); depth.setEnableDto(true); MultiObject2OneDtoSecondsecond=newMultiObject2OneDtoSecond(); second.setBirthdayDto(newDate()); second.setLocalDateTimeDto(LocalDateTime.now()); second.setDepthDto(depth); MultiObject2OneVovo=MultiObject2OneMapper.INSTANCE.dto2Vo(first, second); System.out.println(vo); } }
自定义转换器
DTO
packagediy.transform; importlombok.Data; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 16:43*/publicclassDiyTransformDto { privateStringintDto; privateStringbooleanDto; privateStringdateDto; privateStringlocalDateTimeDto; privateStringuserIntDto; privateStringuserStringDto; privateStringenumDto; privateDatedate2LocalDateTimeDto; privateLocalDateTimelocalDateTime2DateDto; }
Vo
DiyTransformUserVo
packagediy.transform; importlombok.Data; /*** @author Anthony* @date 2020/9/11 16:48*/publicclassDiyTransformUserVo { privateIntegeruserIntVo; privateStringuserStringVo; }
DiyTransformVo
packagediy.transform; importlombok.Data; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 16:44*/publicclassDiyTransformVo { privateIntegerintVo; privateBooleanbooleanVo; privateDatedateVo; privateLocalDateTimelocalDateTimeVo; privateDiyTransformUserVouserVo; privateDiyTransformDeleteEnumenumVo; privateLocalDateTimedate2LocalDateTimeVo; privateDatelocalDateTime2DateVo; }
自定义转换器
packagediy.transform.handler; importjava.time.LocalDateTime; importjava.time.ZoneId; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 18:01*/publicclassDateTransformHandler { publicstaticDatelocalDateTime2Date(LocalDateTimelocalDateTime){ if (null==localDateTime){ thrownewRuntimeException(""); } returnDate.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); } publicstaticLocalDateTimedate2LocalDateTime(Datedate){ if (null==date){ thrownewRuntimeException(""); } returndate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); } }
枚举类
packagediy.transform; /*** @author Anthony* @date 2020/9/11 16:52*/publicenumDiyTransformDeleteEnum { DELETE_NO(0, "未删除"), DELETE_YES(1, "已删除") ; privateIntegercode; privateStringdesc; publicstaticDiyTransformDeleteEnumgetDeleteEnumByCode(intcode){ for (DiyTransformDeleteEnumanEnum : DiyTransformDeleteEnum.values()) { if (code==anEnum.code){ returnanEnum; } } thrownewRuntimeException("获取不到对应的枚举类型"); } DiyTransformDeleteEnum(Integercode, Stringdesc) { this.code=code; this.desc=desc; } publicIntegergetCode() { returncode; } publicvoidsetCode(Integercode) { this.code=code; } publicStringgetDesc() { returndesc; } publicvoidsetDesc(Stringdesc) { this.desc=desc; } publicStringtoString() { return"DiyTransformDeleteEnum{"+"code="+code+", desc='"+desc+'\''+'}'; } }
自定义映射器
packagediy.transform; importdiy.transform.handler.DateTransformHandler; importorg.mapstruct.Mapper; importorg.mapstruct.Mapping; importorg.mapstruct.factory.Mappers; /*** 第一种方式:* @Mapper(uses = {DateTransformHandler.class}) :使用自定义的转换器* @author Anthony* @date 2020/9/11 16:45*/uses= {DateTransformHandler.class}) (publicinterfaceDiyTransformMapper { DiyTransformMapperINSTANCE=Mappers.getMapper(DiyTransformMapper.class); source="intDto", target="intVo") (source="booleanDto", target="booleanVo") (source="dateDto", target="dateVo", dateFormat="yyyy-MM-dd HH:mm:ss") (source="localDateTimeDto", target="localDateTimeVo", dateFormat="yyyy-MM-dd HH:mm:ss") (// 第二种方式:使用自定义的转换器expression="java(string2Enum(diyTransformDto.getEnumDto()))",target="enumVo") (source="userIntDto", target="userVo.userIntVo") (source="userStringDto", target="userVo.userStringVo") (source="date2LocalDateTimeDto", target="date2LocalDateTimeVo") (source="localDateTime2DateDto", target="localDateTime2DateVo") (DiyTransformVodto2Vo(DiyTransformDtodiyTransformDto); /*** 转义枚举* @param code* @return*/defaultDiyTransformDeleteEnumstring2Enum(Stringcode){ if (null==code||code.length() ==0){ thrownewRuntimeException("解析枚举失败"); } IntegercodeInt=Integer.valueOf(code); returnDiyTransformDeleteEnum.getDeleteEnumByCode(codeInt); } }
单元测试
packagediy.transform; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 16:45*/publicclassDiyTransformApplication { publicstaticvoidmain(String[] args) { DiyTransformDtodto=newDiyTransformDto(); dto.setIntDto("9"); dto.setBooleanDto("true"); dto.setDateDto("2020-01-01 14:00:00"); dto.setLocalDateTimeDto("2020-02-02 14:00:00"); dto.setUserIntDto("7"); dto.setUserStringDto("username"); dto.setEnumDto("1"); dto.setLocalDateTime2DateDto(LocalDateTime.now()); dto.setDate2LocalDateTimeDto(newDate()); DiyTransformVovo=DiyTransformMapper.INSTANCE.dto2Vo(dto); System.out.println(vo); } }
反向映射-属性相同
DTO
packagemapping.reverse.property.same; importlombok.Data; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 18:35*/publicclassMappingReversePropertySameDto { privateIntegeridSame; privateStringnameDto; privateDatedateDto; }
VO
packagemapping.reverse.property.same; importlombok.Data; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 18:35*/publicclassMappingReversePropertySameVo { privateIntegeridSame; privateStringnameVo; privateDatedateVo; }
自定义映射器
packagemapping.reverse.property.same; importorg.mapstruct.InheritInverseConfiguration; importorg.mapstruct.Mapper; importorg.mapstruct.Mapping; importorg.mapstruct.factory.Mappers; /*** @author Anthony* @date 2020/9/11 18:35*/publicinterfaceMappingReversePropertySameMapper { MappingReversePropertySameMapperINSTANCE=Mappers.getMapper(MappingReversePropertySameMapper.class); source="nameDto", target="nameVo") (source="dateDto", target="dateVo") (MappingReversePropertySameVodto2Vo(MappingReversePropertySameDtomappingReversePropertySameDto); /*** 反向映射:添加注解 @InheritInverseConfiguration(name = "dto2Vo")* 如果多个方法符合条件,需要在 name 指定对应的方法名* @param mappingReversePropertySameVo* @return*/name="dto2Vo") (MappingReversePropertySameDtovo2Dto(MappingReversePropertySameVomappingReversePropertySameVo); }
单元测试
packagemapping.reverse.property.same; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 18:36*/publicclassMappingReversePropertySameApplication { publicstaticvoidmain(String[] args) { MappingReversePropertySameDtodto=newMappingReversePropertySameDto(); dto.setDateDto(newDate()); dto.setIdSame(1); dto.setNameDto("name"); MappingReversePropertySameVovo=MappingReversePropertySameMapper.INSTANCE.dto2Vo(dto); System.out.println(vo); MappingReversePropertySameDtovo2Dto=MappingReversePropertySameMapper.INSTANCE.vo2Dto(vo); System.out.println(vo2Dto); } }
反向映射-属性不同
枚举
packagemapping.reverse.property.diff; /*** @author Anthony* @date 2020/9/11 19:02*/publicenumMappingReversePropertyDiffEnum { YES(1, "YES"), NO(0, "NO"), ; publicstaticMappingReversePropertyDiffEnumgetEnumByCode(Integercode){ for (MappingReversePropertyDiffEnumanEnum : MappingReversePropertyDiffEnum.values()) { if (code==anEnum.code){ returnanEnum; } } thrownewRuntimeException(""); } privateIntegercode; privateStringdesc; MappingReversePropertyDiffEnum(Integercode, Stringdesc) { this.code=code; this.desc=desc; } publicIntegergetCode() { returncode; } publicvoidsetCode(Integercode) { this.code=code; } publicStringgetDesc() { returndesc; } publicvoidsetDesc(Stringdesc) { this.desc=desc; } }
DTO
packagemapping.reverse.property.diff; importlombok.Data; /*** @author Anthony* @date 2020/9/11 18:50*/publicclassMappingReversePropertyDiffDto { privateStringidDto; privateStringtoDateDto; privateStringtoLocalDateTimeDto; privateStringtoEnum; }
VO
packagemapping.reverse.property.diff; importlombok.Data; importjava.time.LocalDateTime; importjava.util.Date; /*** @author Anthony* @date 2020/9/11 18:50*/publicclassMappingReversePropertyDiffVo { privateIntegeridVo; privateDatetoDateVo; privateLocalDateTimetoLocalDateTimeVo; privateMappingReversePropertyDiffEnumanEnum; }
自定义映射器
packagemapping.reverse.property.diff; importorg.mapstruct.InheritInverseConfiguration; importorg.mapstruct.Mapper; importorg.mapstruct.Mapping; importorg.mapstruct.factory.Mappers; /*** @author Anthony* @date 2020/9/11 18:50*/publicinterfaceMappingReversePropertyDiffMapper { MappingReversePropertyDiffMapperINSTANCE=Mappers.getMapper(MappingReversePropertyDiffMapper.class); source="idDto", target="idVo") (source="toDateDto", target="toDateVo", dateFormat="yyyy-MM-dd HH:mm:ss") (source="toLocalDateTimeDto", target="toLocalDateTimeVo", dateFormat="yyyy-MM-dd HH:mm:ss") (expression="java(toEnum(mappingReversePropertyDiffDto.getToEnum()))", target="anEnum") (MappingReversePropertyDiffVodto2Vo(MappingReversePropertyDiffDtomappingReversePropertyDiffDto); /*** 反向映射:添加注解 @InheritInverseConfiguration(name = "dto2Vo")* 如果多个方法符合条件,需要在 name 指定对应的方法名* 如果不满足反向映射需要自定义方法反向映射* @param mappingReversePropertySameVo* @return*/name="dto2Vo") (expression="java(enum2String(mappingReversePropertySameVo.getAnEnum()))", target="toEnum") (MappingReversePropertyDiffDtovo2Dto(MappingReversePropertyDiffVomappingReversePropertySameVo); defaultMappingReversePropertyDiffEnumtoEnum(Stringcode){ if (null==code||code.length() <=0){ thrownewRuntimeException(""); } returnMappingReversePropertyDiffEnum.getEnumByCode(Integer.valueOf(code)); } /*** 自定义方法反向映射* @param anEnum* @return*/defaultStringenum2String(MappingReversePropertyDiffEnumanEnum){ returnString.valueOf(anEnum.getCode()); } }
单元测试
packagemapping.reverse.property.diff; /*** @author Anthony* @date 2020/9/11 18:50*/publicclassMappingReversePropertyDiffApplication { publicstaticvoidmain(String[] args) { MappingReversePropertyDiffDtodto=newMappingReversePropertyDiffDto(); dto.setIdDto("1"); dto.setToDateDto("2020-01-01 14:00:00"); dto.setToLocalDateTimeDto("2020-12-31 14:00:00"); dto.setToEnum("0"); MappingReversePropertyDiffVovo=MappingReversePropertyDiffMapper.INSTANCE.dto2Vo(dto); System.out.println(vo); MappingReversePropertyDiffDtovo2Dto=MappingReversePropertyDiffMapper.INSTANCE.vo2Dto(vo); System.out.println(vo2Dto); } }