mapstruct-kotlin
mapstruct-kotlin copied to clipboard
Mapping of UUID to String error
I have an issue with Kotlin -> kapt -> mapstruct
I have 2 data classes
@Entity(name = "PLAN") @TypeDef(name = "pgsql_enum", typeClass = PostgreSQLEnumType::class) @KotlinBuilder data class Plan(
@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
@JsonProperty("uuid")
val uuid: UUID? = null,
@Column(nullable = false)
val name: String,
...
@Document(collection = "plan") @KotlinBuilder data class MongoPlan(
val uuid: String? = null,
val name: String,
....
and mapping instructions
@Mapper interface MongoPlanMapper {
@Mappings(Mapping(target = "uuid",
qualifiedByName = ["uuidMapper"]))
fun convert(plan: Plan): MongoPlan
@Named("uuidMapper")
fun uuidMapper(uuid: UUID): String =
uuid.toString()
}
and I get
Error: java:".
@AlehGalo Thank you for the report, first please make sure that the issue you mentioned is not only related to mapstruct. If you have time could you please provide me a very basic project where you can reproduce this issue ?