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 895311c208
commit 441609c4bf
4 changed files with 8 additions and 16 deletions

View File

@@ -130,8 +130,7 @@ public 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

@@ -42,6 +42,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
@@ -137,9 +138,7 @@ public class ReactiveWrappers {
return Arrays.stream(type.getMethods())//
.flatMap(ReflectionUtils::returnTypeAndParameters)//
.anyMatch(possibleReactiveSupportedType ->
ReactiveWrapperConverters.supports(possibleReactiveSupportedType)
&& findDescriptor(possibleReactiveSupportedType).isPresent());
.anyMatch(ReactiveWrappers::supports);
}
/**
@@ -250,7 +249,7 @@ public 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();