I have this Mapper, and I want to convert a Entity to a DTO. My Entity contains the variable createdDate who is an Instant and my DTO contains commentedDate who is a Timestamp.
I don't know how it's possible to convert automatically the Instant to Timestamp whit MapStruct.
public interface BlogMapper {
@Mappings({
@Mapping(target = "userId", source = "user.id"),
@Mapping(target = "commentedDate", source = "createdDate")
})
BlogDto entityToDto(final Comment entity);
}
Thanks for your help :)