Question about mapstruct! I have this POJO: ```d...
# getting-started
a
Question about mapstruct! I have this POJO:
Copy code
data class WorkOrderCommentFilter constructor(
    val pagination: WorkOrderCommentPaginationFilter? = null,
    val id: Int? = null,
    val workOrderId: Int? = null,
    val comment: String? = null,
    val checkpointTypeName: String? = null,
    val createdAt: LocalDateTime? = null,
)
and this POJO:
Copy code
@Introspected
data class WorkOrderCommentFilterDto constructor(
    @field:[QueryValue Parameter(description = "Pagination object")]
    val pagination: WorkOrderCommentPaginationFilter? = null,
    @field:[QueryValue Parameter(description = "Comment Id", example = "1")]
    val id: Int? = null,
    @field:[QueryValue Parameter(description = "WorkOrder Id", example = "1")]
    val workOrderId: Int? = null,
    @field:[QueryValue Parameter(description = "Comment message")]
    val comment: String? = null,
    @field:[QueryValue Parameter(description = "CheckpointType name")]
    val checkpointTypeName: String? = null,
    @field:[QueryValue Parameter(description = "Comment creation date")]
    val createdAt: Long? = null,
)
when I use a mapper like this:
Copy code
@Mapper(componentModel = "jsr330", uses = [LocalDateTimeLongMapper::class])
interface WorkOrderCommentMapper {
     fun toDao(workOrderCommentFilterDto: WorkOrderCommentFilterDto): WorkOrderCommentFilter
}
The implementation is not right:
Copy code
@Override
public WorkOrderCommentFilter toDao(WorkOrderCommentFilterDto workOrderCommentFilterDto) {
    if ( workOrderCommentFilterDto == null ) {
       return null;
   }

   WorkOrderCommentFilter workOrderCommentFilter = new WorkOrderCommentFilter();

   return workOrderCommentFilter;
}
I feel like I must be missing something, right? Thanks for any help in advance!
🧵 1
m
what IDE are you working in that its not complaining about your implementation of
toDao
not having the correct type signature?
Since your implementation doesn't have a return type
a
what do you mean? I’m using intellij
m
your interface promises a return of WorkOrderCommentFilter. While your implementation override doesn't promise that return, it's a simple unit function
oh wait your implentation is java?
a
my implementation is the result from mapstruct. I actually got this response from them:
Issues concerning this have been reported, see mapstruct/mapstruct#2577 and mapstruct/mapstruct#2281 .