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:
Mark Paluch
2020-06-25 10:45:38 +02:00
parent 558272e57b
commit c9a5a19738
4 changed files with 8 additions and 16 deletions

View File

@@ -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;
}
/**

View File

@@ -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();