mapstruct / mapstruct/mapstruct
Support a real expression language in Mapping#expression()
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
There should be support for a real expression language in Mapping#expression():
```
@Mapping(target="foo", source="bar.firstName + ' ' + bar.lastName")
```
Possible candidates are Unified EL or SpEL. The latter allows constructor invocations which would be very useful. The general idea is to translate the given expressions into equivalent Java source code which then is embedded into the generated mapping method. Bot UEL (via JUEL) and SpEL allow to access and traverse the AST of given expressions for that purpose.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Mapping#expression() and review how generated mapping methods currently embed expressions. Compare Unified EL via JUEL and SpEL, including their AST access and constructor-invocation behavior. Done means selecting and implementing an expression-language approach that translates the supplied expression into equivalent Java source in the generated mapping method.
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