Strangle old inspector methods

Fixes gh-81
This commit is contained in:
Dave Syer
2017-07-12 14:29:44 +01:00
parent d7d49858f6
commit c8646d64d8
12 changed files with 123 additions and 186 deletions

View File

@@ -62,8 +62,6 @@ public class SpringFunctionInitializer implements Closeable {
@Autowired(required = false)
private FunctionCatalog catalog;
private String name;
private ConfigurableApplicationContext context;
public SpringFunctionInitializer(Class<?> configurationClass) {
@@ -102,19 +100,16 @@ public class SpringFunctionInitializer implements Closeable {
}
else {
this.function = this.catalog.lookupFunction(name);
this.name = name;
if (this.function == null) {
if (defaultName) {
name = "consumer";
}
this.consumer = this.catalog.lookupConsumer(name);
this.name = name;
if (this.consumer == null) {
if (defaultName) {
name = "supplier";
}
this.supplier = this.catalog.lookupSupplier(name);
this.name = name;
}
}
}
@@ -123,11 +118,16 @@ public class SpringFunctionInitializer implements Closeable {
protected Class<?> getInputType() {
if (inspector != null) {
return inspector.getInputType(this.name);
return inspector.getInputType(function());
}
return Object.class;
}
private Object function() {
return this.function != null ? this.function
: (this.consumer != null ? this.consumer : this.supplier);
}
protected Flux<?> apply(Flux<?> input) {
if (this.function != null) {
return function.apply(input);