Skip to content

Support getting a value or invoking a supplier if the value is not set#24

Merged
filiphr merged 2 commits into
mapstruct:mainfrom
hduelme:Support-getting-a-value-or-invoking-a-supplier-if-the-value-is-not-set
Jun 2, 2026
Merged

Support getting a value or invoking a supplier if the value is not set#24
filiphr merged 2 commits into
mapstruct:mainfrom
hduelme:Support-getting-a-value-or-invoking-a-supplier-if-the-value-is-not-set

Conversation

@hduelme
Copy link
Copy Markdown
Collaborator

@hduelme hduelme commented Mar 16, 2026

I implemented #8, inspired by Optinal.orElseGet from the Java standard library.

Fixes #8

@filiphr
Copy link
Copy Markdown
Member

filiphr commented Mar 16, 2026

Thanks @hduelme. Can we maybe add a test case for this?

@hduelme
Copy link
Copy Markdown
Collaborator Author

hduelme commented Mar 16, 2026

@filiphr I added tests for the public API. For now this covers create and createArray. I intentionally avoided parameterizing the tests or extracting assertion helpers, since that would make the tests less readable.

@filiphr filiphr merged commit 19626c2 into mapstruct:main Jun 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support getting a value or invoking a supplier if the value is not set

2 participants