Skip to content

No easy way to disable hasXxx() presence check #536

Description

@markusdap

Hi and thank you for this addition to mapstruct. We have some requirements, where we need to map a proto to a Java DTO, which is then sent via a rest api. And that Object has some required fields, so even, if a nested proto field does not exist I still want it to be mapped. So I want this if check to be removed:

if ( from.hasxxx() ) {
            ...
 }

Right now, I only managed this by turning the mapper interface into an abstract class and then having and @AfterMapping method. Is there some other way, an option or anything, so I do not have to use aftermapping?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions