mapstruct / mapstruct/mapstruct

shared config enhancement

Open
#2,091 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
7.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

I have tried the change #1979 & it is a great improvement but still not enough & not in current release 1.3.1. I would suggest to further enhance it by allowing wildcard approach. and/or type based one. Also multiple field ignore should be allowed in Mapping instead of add one for each field. For example,

```java
class A {
private B b1;
private B b2;
private D d;
}

class AA {
private BB b1;
private BB b2;
}

class B {
private String str;
private C c1;
private C c2;
// any fields primitive or otherwise
}

class BB {
private String str;
private CC c1;
private CC c2;
// any fields primitive or otherwise
}

class C {
private String str1;
private String str2;
}

class CC {
private String str1;
private String str2;
}

class D {
private String str;
}

interface AMapper {
// wild card approach
@Mapping(target = {"*.[str1]","*.*.[str1,str2]"}, ignore=true)
// type based
@Mapping(target = {"Class[B,D].(str1)","Class[B].Class[C].(str1,str2)"}, ignore=true)
AA toAA(A a);
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #1979 and the current Mapping annotation/API behavior. The proposal needs an agreed design for wildcard targets, type-based selection, and multiple ignored fields before implementation can begin; done would require defined syntax and behavior for each case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.