Skip to content

Is there a way to ignore mapping all fields except one field in Mapstruct ? #2044

@ER-GAIBI

Description

@ER-GAIBI

Hi,
As mentionned in the title, is there a way to avoid ignoring all fileds (> 20) of the target class without using ignore = true

I am asking this question because I have to map just the Id field and not all of them.

for example :

    @Mapping(target = "opportunity", ignore = true )
    @Mapping(target = "updateDate", ignore = true)
    @Mapping(target = "simpleVarsRemaining", ignore = true)
    @Mapping(target = "ficheEmmiesRemaining", ignore = true)
    @Mapping(target = "creationDate", ignore = true)
    @Mapping(target = "editionDate", ignore = true)
    @Mapping(target = "ficheCalcul", ignore = true)
    @Mapping(target = "institution", ignore = true)
    @Mapping(target = "verificateur1", ignore = true)
    @Mapping(target = "verificateur2", ignore = true)
    @Mapping(target = "installateur", ignore = true)
    @Mapping(target = "soustraitant", ignore = true)
    @Mapping(target = "fiche", ignore = true)
    @Mapping(target = "instutitionName", ignore = true)
    @Mapping(target = "inFolder", ignore = true)
    @Mapping(target = "isCpe", ignore = true)
    @Mapping(target = "cpe", ignore = true)
    @Mapping(target = "forfait", ignore = true)
    @Mapping(target = "folderId", ignore = true)
    @Mapping(target = "folderName", ignore = true)
    @Named(value = "filterMapperForDocument")
    OperationDTO toOperationDTOForDocumentFilter(Operation operation);

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