interim
This commit is contained in:
@@ -981,8 +981,8 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
||||
/*
|
||||
*
|
||||
*/
|
||||
private boolean isConversionHintRequired(Object actualType, Class<?> rawType) {
|
||||
return rawType != actualType;
|
||||
private boolean isConversionHintRequired(Type actualType, Class<?> rawType) {
|
||||
return rawType != actualType; // && !FunctionTypeUtils.isMessage(actualType);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1003,14 +1003,28 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
||||
}
|
||||
}
|
||||
|
||||
Object convertedInput = message;
|
||||
type = this.extractActualValueTypeIfNecessary(type);
|
||||
Class rawType = FunctionTypeUtils.getRawType(type);
|
||||
convertedInput = this.isConversionHintRequired(type, rawType)
|
||||
? SimpleFunctionRegistry.this.messageConverter.fromMessage(message, rawType, type)
|
||||
: SimpleFunctionRegistry.this.messageConverter.fromMessage(message, rawType);
|
||||
Object convertedInput = message.getPayload();
|
||||
|
||||
if (this.isInputTypeMessage()) {
|
||||
// if (FunctionTypeUtils.isMessage(type) && FunctionTypeUtils.getRawType(type)) {
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// type = this.extractActualValueTypeIfNecessary(type);
|
||||
|
||||
Type itemType = this.extractActualValueTypeIfNecessary(type);
|
||||
Class<?> rawType = FunctionTypeUtils.isMessage(type)
|
||||
? FunctionTypeUtils.getRawType(itemType)
|
||||
: FunctionTypeUtils.getRawType(type);
|
||||
// if (!rawType.isAssignableFrom(message.getPayload().getClass())) {
|
||||
convertedInput = this.isConversionHintRequired(type, rawType)
|
||||
? SimpleFunctionRegistry.this.messageConverter.fromMessage(message, rawType, itemType)
|
||||
: SimpleFunctionRegistry.this.messageConverter.fromMessage(message, rawType);
|
||||
// }
|
||||
|
||||
|
||||
if (FunctionTypeUtils.isMessage(type)) {
|
||||
if (convertedInput == null) {
|
||||
/*
|
||||
* In the event conversion was unsuccessful we simply return the original un-converted message.
|
||||
@@ -1099,11 +1113,15 @@ public class SimpleFunctionRegistry implements FunctionRegistry, FunctionInspect
|
||||
else if (FunctionTypeUtils.isFlux(type) && publisher instanceof Mono) {
|
||||
publisher = Flux.from(publisher);
|
||||
}
|
||||
Type actualType = type != null ? FunctionTypeUtils.getGenericType(type) : type;
|
||||
Type actualType = type != null && FunctionTypeUtils.isPublisher(type) ? FunctionTypeUtils.getImmediateGenericType(type, 0) : type;
|
||||
// Type actualType = type != null ? FunctionTypeUtils.getGenericType(type, 0) : type;
|
||||
// if (actualType == null) {
|
||||
// actualType = type;
|
||||
// }
|
||||
return publisher instanceof Mono
|
||||
? Mono.from(publisher).map(v -> this.convertInputIfNecessary(v, actualType))
|
||||
? Mono.from(publisher).map(v -> this.convertInputIfNecessary(v, actualType == null ? type : actualType))
|
||||
.doOnError(ex -> logger.error("Failed to convert input", (Throwable) ex))
|
||||
: Flux.from(publisher).map(v -> this.convertInputIfNecessary(v, actualType))
|
||||
: Flux.from(publisher).map(v -> this.convertInputIfNecessary(v, actualType == null ? type : actualType))
|
||||
.doOnError(ex -> logger.error("Failed to convert input", (Throwable) ex));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user