More polishing in ContextFunctionCatalog

This commit is contained in:
Oleg Zhurakousky
2019-02-06 19:08:44 +01:00
parent 5b98c01d2a
commit b1fa949dd9

View File

@@ -283,7 +283,7 @@ public class ContextFunctionCatalogAutoConfiguration {
return function; return function;
} }
else { else {
logger.warn("The resulting composition is is of type " logger.warn("The resulting composition is of type "
+ types.get(normalizeName(name))); + types.get(normalizeName(name)));
} }
return null; return null;
@@ -490,25 +490,23 @@ public class ContextFunctionCatalogAutoConfiguration {
private FunctionType findType(Object function) { private FunctionType findType(Object function) {
String name = this.names.get(function); String name = this.names.get(function);
FunctionType functionType;
if (this.types.containsKey(name)) { if (this.types.containsKey(name)) {
return this.types.get(name); functionType = this.types.get(name);
}
FunctionType param;
if (name == null || this.beanFactory == null
|| !this.beanFactory.containsBeanDefinition(name)) {
if (function != null) {
param = new FunctionType(function.getClass());
}
else {
param = FunctionType.UNCLASSIFIED;
}
} }
else { else {
param = new FunctionType( functionType = functionByNameExist(name)
FunctionContextUtils.findType(name, this.beanFactory)); ? new FunctionType(function.getClass()) : new FunctionType(
FunctionContextUtils.findType(name, this.beanFactory));
this.types.computeIfAbsent(name, str -> functionType);
} }
this.types.computeIfAbsent(name, str -> param);
return param; return functionType;
}
private boolean functionByNameExist(String name) {
return name == null || this.beanFactory == null
|| !this.beanFactory.containsBeanDefinition(name);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")