DATACMNS-1753 - Polishing.
Check for deferred types in ReactiveWrappers so that ReactiveWrapperConverters remains untouched as wrapper conversion from a reactive type into CompletableFuture is still possible from a ReactiveWrapperConverters perspective. Original pull request: #450.
This commit is contained in:
@@ -140,8 +140,7 @@ public abstract class ReactiveWrapperConverters {
|
||||
*/
|
||||
public static boolean supports(Class<?> type) {
|
||||
return RegistryHolder.REACTIVE_ADAPTER_REGISTRY != null
|
||||
&& RegistryHolder.REACTIVE_ADAPTER_REGISTRY.getAdapter(type) != null
|
||||
&& RegistryHolder.REACTIVE_ADAPTER_REGISTRY.getAdapter(type).getDescriptor().isDeferred();
|
||||
&& RegistryHolder.REACTIVE_ADAPTER_REGISTRY.getAdapter(type) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Mark Paluch
|
||||
* @author Christoph Strobl
|
||||
* @author Oliver Gierke
|
||||
* @author Gerrit Meier
|
||||
* @since 2.0
|
||||
* @see org.reactivestreams.Publisher
|
||||
* @see rx.Single
|
||||
@@ -157,9 +158,7 @@ public abstract class ReactiveWrappers {
|
||||
|
||||
return Arrays.stream(type.getMethods())//
|
||||
.flatMap(ReflectionUtils::returnTypeAndParameters)//
|
||||
.anyMatch(possibleReactiveSupportedType ->
|
||||
ReactiveWrapperConverters.supports(possibleReactiveSupportedType)
|
||||
&& findDescriptor(possibleReactiveSupportedType).isPresent());
|
||||
.anyMatch(ReactiveWrappers::supports);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,7 +269,7 @@ public abstract class ReactiveWrappers {
|
||||
|
||||
ReactiveAdapter adapter = adapterRegistry.getAdapter(type);
|
||||
if (adapter != null && adapter.getDescriptor().isDeferred()) {
|
||||
return Optional.ofNullable(adapter.getDescriptor());
|
||||
return Optional.of(adapter.getDescriptor());
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
|
||||
Reference in New Issue
Block a user