Support java.util.Optional as parameter type in resource methods
Open
Component: filters&handlers
- Dominant language
- Java
- Stars
- 400
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
Jersey fills in missing optional resource method arguments with 'null'. Dealing with "possibly null" variables can be a bit of an annoyance, so more than often I do
Optional optArg1 = Optional.ofNullable(arg1);
Optional optArg2 = Optional.ofNullable(arg2);
...
at the top of my resource methods. This opens up for use of many convenience methods such as map, orElse, orElseThrow, ifPresent etc.
So, request for enhancement: Let Jersey handle java.util.Optional as parameter type in resource methods directly.
Contributor guide
Assessment
This issue has not been assessed yet.