Skip to content

@AfterMapping and @Mapper(unmappedTargetPolicy = ReportingPolicy.ERROR) reports an error at compile time #3567

Answered by filiphr
stessy asked this question in Q&A
Discussion options

You must be logged in to vote

The reason why you are getting the error is due to the fact that MapStruct is not able to map those 4 fields. MapStruct has no way of knowing what is being done in the @AfterMapping.

If you want to use ReportingPolicy.ERROR as the unmapped target policy then you should ignore explicitly those 4 methods via @Maping(target = "secondaryTelemDecision1", ignore = true)

I don't know how your objects are created, but in your case I would not expose setters for the secondaryTelemDecision1 and the rest. I would instead do

public class GrantingResponseVo {


    public TelemDecision getSecondaryTelemDecision1() {
        return telemDecisionsSecondaryList != null && !telemDecisionsSecondaryList.isE…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@stessy
Comment options

Answer selected by stessy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants