GH-383 Ensure FunctionType retains ParameterizedType as 'type' filed

Resolves #383
This commit is contained in:
Oleg Zhurakousky
2019-07-03 16:06:41 +02:00
parent e6625394a8
commit 1cf42f95f6
2 changed files with 28 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ import reactor.core.publisher.Flux;
import org.springframework.core.ResolvableType;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.messaging.Message;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
/**
@@ -105,7 +106,14 @@ public class FunctionType {
}
public static FunctionType of(Type function) {
return new FunctionType(function);
FunctionType ft = new FunctionType(function);
if (!ft.isWrapper() && !(ft.type instanceof ParameterizedType)) {
Type[] genericInterfaces = ((Class<?>) function).getGenericInterfaces();
if (!ObjectUtils.isEmpty(genericInterfaces)) {
ft.type = genericInterfaces[0];
}
}
return ft;
}
public static FunctionType from(Class<?> input) {