DATACMNS-1191 - Avoid unnecessary investigation of converters in QueryExecutionResultHandler.
On query execution conversion, we now check an unwrapped Optional's value for assignability to the target type before looking into advanced conversion options to avoid unnecessary code invocations that would eventually return the same instance anyway.
This commit is contained in:
@@ -66,12 +66,20 @@ class QueryExecutionResultHandler {
|
||||
|
||||
Class<?> expectedReturnType = returnTypeDescriptor.getType();
|
||||
|
||||
// Early return if the raw value matches
|
||||
|
||||
if (result != null && expectedReturnType.isInstance(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = unwrapOptional(result);
|
||||
|
||||
// Early return if the unrwapped value matches
|
||||
|
||||
if (result != null && expectedReturnType.isInstance(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (QueryExecutionConverters.supports(expectedReturnType)) {
|
||||
|
||||
TypeDescriptor targetType = TypeDescriptor.valueOf(expectedReturnType);
|
||||
|
||||
Reference in New Issue
Block a user