在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Pozo/mapstruct-kotlin开源软件地址(OpenSource Url):https://github.com/Pozo/mapstruct-kotlin开源编程语言(OpenSource Language):Kotlin 66.5%开源软件介绍(OpenSource Introduction):mapstruct-kotlin
Since mapstruct 1.3.0.Beta2 it's possible to use builders for immutable classes. According to the documentation you can implement your custom builder provider logic. This project take advantage of this and provide a custom So instead of this (source) data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) {
// Necessary for MapStruct
constructor() : this(null, null, null, null)
} We can do this @KotlinBuilder
data class PersonDto(val firstName: String, val lastName: String, val phone: String, val birthdate: LocalDate) With a mapper @Mapper
interface PersonMapper {
fun map(person: Person): PersonDto
} UsageFirst apply kapt plugin apply plugin: 'kotlin-kapt' Then add these to your project as dependency api("com.github.pozo:mapstruct-kotlin:1.3.1.2")
kapt("com.github.pozo:mapstruct-kotlin-processor:1.3.1.2") Check out the directory VersioningFor example in case of Project structure
Build and run the example application
TODO
LicensingPlease see LICENSE file ContactZoltan Polgar - [email protected] Please do not hesitate to contact me if you have any further questions. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论