DATACMNS-867 - ReflectionRepositoryInvoker now avoids ConversionService for Optional creation.
We now manually create Optional instances as the ConversionService converts single-argument collections into an optional with only that element.
This commit is contained in:
@@ -253,16 +253,8 @@ class ReflectionRepositoryInvoker implements RepositoryInvoker {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> Optional<T> returnAsOptional(Object source) {
|
||||
|
||||
if (Optional.class.isInstance(source)) {
|
||||
return (Optional<T>) source;
|
||||
}
|
||||
|
||||
if (source == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return conversionService.convert(QueryExecutionConverters.unwrap(source), Optional.class);
|
||||
return (Optional<T>) (Optional.class.isInstance(source) ? source
|
||||
: Optional.ofNullable(QueryExecutionConverters.unwrap(source)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user