★ wanayoo — archive 1999 https://github.com/graphql-java/graphql-java/pull/1684Nouvelle recherche | Portail wanayoo
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

add hook to allow for custom value unboxing #1684

Merged
merged 5 commits into from Jan 13, 2020
Merged

Conversation

@andimarek
Copy link
Member

@andimarek andimarek commented Oct 25, 2019 •

This PR adds a general ValuUnboxer hook which lets you implement a custom logic for unboxing values. The default impl unboxes only java.lang.Optional.

@andimarek andimarek requested a review from bbakerman Oct 25, 2019
@seanb4t
Copy link
Contributor

@seanb4t seanb4t commented Oct 25, 2019

While a bit more intrusive a change than #1582 ( even considering that it is my PR ) obviously this works as well.

I'm not personally convinced that the ServiceLoader approach is too much cognitive dissonance, but don't have any concerns that this will address the need I was trying to fill with #1582

@andimarek andimarek force-pushed the optional-unboxer-hook branch from a4b6d2f to b8e8aca Oct 28, 2019
@andimarek
Copy link
Member Author

@andimarek andimarek commented Oct 28, 2019

@sean-brandt you are right: it is a more intrusive change, but we are happy to pay this price for more consistency for our users.

@andimarek andimarek added this to the 14.0 milestone Oct 30, 2019
@kaqqao
Copy link
Contributor

@kaqqao kaqqao commented Nov 12, 2019 •

Just a thought, but why not go for a more general solution for converting/adapting values and then implement unboxing optionals in terms of that? The general framework doesn't have to immediately be public either, just be there for future extensions. Where I come from (generating GraphQL schemas dynamically), such a solution would be widely applicable. I have a similar custom implementation in place already.
As it stands, the current approach solves a highly specialized problem only, at the expense of a rather intrusive change...

@andimarek
Copy link
Member Author

@andimarek andimarek commented Jan 12, 2020

this hook actually allows you to "unbox" any value. So it that sense it is a general solution. Will try to make the naming more clear

@andimarek andimarek force-pushed the optional-unboxer-hook branch from dacd970 to c996320 Jan 13, 2020
@andimarek andimarek changed the title add hook to allow for custom optional unboxing add hook to allow for custom value unboxing Jan 13, 2020
@andimarek andimarek merged commit 52de81a into master Jan 13, 2020
3 checks passed
3 checks passed
build
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@andimarek andimarek deleted the optional-unboxer-hook branch Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.