Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upadd hook to allow for custom value unboxing #1684
Conversation
|
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 |
|
@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. |
|
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. |
|
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 |
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.