use of org.mule.runtime.module.extension.internal.runtime.function.FunctionExecutor in project mule by mulesoft.
the class ExtensionActivator method registerExpressionFunctions.
private void registerExpressionFunctions(Stream<FunctionModel> functions, ExpressionModule.Builder module) {
final FunctionParameterDefaultValueResolverFactory valueResolverFactory = (defaultValue, type) -> context -> {
ExtendedExpressionManager em = muleContext.getExpressionManager();
String value = String.valueOf(defaultValue);
return em.isExpression(value) ? em.evaluate(value, type, context) : new TypedValue<>(defaultValue, type);
};
functions.forEach(function -> function.getModelProperty(FunctionExecutorModelProperty.class).ifPresent(mp -> {
FunctionExecutor executor = mp.getExecutorFactory().createExecutor(function, valueResolverFactory);
lifecycleAwareElements.add(executor);
module.addBinding(function.getName(), new TypedValue<>(executor, fromFunction(executor)));
}));
}
Aggregations