Add "wrapper" type methods to FunctionInspector

These can be used to more reliably discover whether the user
has declared a function with flux types or "bare" POJOs. They
then pave the way to supporting single valued types in a special
way.

Also consolidate and simplify the logic in FunctionInspector
This commit is contained in:
Dave Syer
2017-05-24 09:08:30 +01:00
parent 719237e9c7
commit 0d2418a47b
11 changed files with 283 additions and 84 deletions

View File

@@ -25,8 +25,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.function.context.FunctionInspector;
import org.springframework.cloud.function.support.FluxSupplier;
import org.springframework.cloud.function.support.FunctionUtils;
import org.springframework.cloud.function.web.flux.request.FluxRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -95,11 +93,7 @@ public class FunctionController {
return supplier(supplier);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private Flux<?> supplier(Supplier<Flux<?>> supplier) {
if (!FunctionUtils.isFluxSupplier(supplier)) {
supplier = new FluxSupplier(supplier);
}
Flux<?> result = supplier.get();
if (logger.isDebugEnabled()) {
logger.debug("Handled GET with supplier");