Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworked CDI principal injection API using Supplier #815

Merged
merged 2 commits into from
Mar 30, 2023

Conversation

lprimak
Copy link
Contributor

@lprimak lprimak commented Mar 29, 2023

Instead of Optional, using generic Supplier object as an injection point

@lprimak lprimak changed the title Reworked CDI principal injection Mar 29, 2023
@lprimak lprimak merged commit b18f099 into apache:main Mar 30, 2023
@lprimak lprimak deleted the principal-injection-holder branch March 30, 2023 17:40
assertNotNull(injectedComponents.getPropertyPincipal());
assertEquals("user", injectedComponents.getPropertyPincipal().orElseThrow().getUserName());
assertNotNull(injectedComponents.getPropertyPrincipal());
assertEquals("user", Optional.ofNullable(injectedComponents.getPropertyPrincipal().get()).orElseThrow().getUserName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use get(), use orElseThrow() (on 8 with NoSuchElementException::new)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get() comes from Supplier now, not Optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants