andymc12 commented on a change in pull request #677:
URL: https://github.com/apache/cxf/pull/677#discussion_r436694266
##########
File path:
rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
##########
@@ -539,21 +547,32 @@ private static RuntimeException
createParamConversionException(ParameterType pTy
}
return ExceptionUtils.toBadRequestException(ex, null);
}
- public static <T> T createFromParameterHandler(String value,
- Class<T> pClass,
- Type genericType,
- Annotation[] anns,
- Message message) {
- T result = null;
+
+ public static <T> Optional<ParamConverter<T>> getParamConverter(Class<T>
pClass,
+ Type genericType, Annotation[] anns, Message message) {
+
if (message != null) {
ServerProviderFactory pf =
ServerProviderFactory.getInstance(message);
ParamConverter<T> pm = pf.createParameterHandler(pClass,
genericType, anns, message);
if (pm != null) {
- result = pm.fromString(value);
+ return Optional.of(pm);
}
}
- return result;
+
+ return Optional.empty();
Review comment:
Minor suggestion - you could replace the if-check and this line with
`return Optional.ofNullable(pm);`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]