use of org.mule.runtime.extension.api.values.ValueProvider in project mule by mulesoft.
the class ValueProviderFactory method createValueProvider.
ValueProvider createValueProvider() throws ValueResolvingException {
Class<? extends ValueProvider> resolverClass = factoryModelProperty.getValueProvider();
try {
ValueProvider resolver = instantiateClass(resolverClass);
initialiseIfNeeded(resolver, true, muleContext);
injectValueProviderFields(resolver);
if (factoryModelProperty.usesConnection()) {
injectValueIntoField(resolver, connectionSupplier.get(), connectionField);
}
if (factoryModelProperty.usesConfig()) {
injectValueIntoField(resolver, configurationSupplier.get(), configField);
}
return resolver;
} catch (ValueResolvingException e) {
throw e;
} catch (Exception e) {
throw new ValueResolvingException("An error occurred trying to create a ValueProvider", UNKNOWN, e);
}
}
use of org.mule.runtime.extension.api.values.ValueProvider in project mule by mulesoft.
the class ValueProviderMediator method resolveValues.
private Set<Value> resolveValues(List<ParameterModel> parameters, ValueProviderFactoryModelProperty factoryModelProperty, ParameterValueResolver parameterValueResolver, Supplier<Object> connectionSupplier, Supplier<Object> configurationSupplier) throws NoSuchMethodException, InstantiationException, IllegalAccessException, java.lang.reflect.InvocationTargetException, InitialisationException, org.mule.runtime.module.extension.internal.runtime.ValueResolvingException, ValueResolvingException {
ValueProvider valueProvider = factoryModelProperty.createFactory(parameterValueResolver, connectionSupplier, configurationSupplier, reflectionCache.get(), muleContext.get()).createValueProvider();
Set<Value> valueSet = valueProvider.resolve();
return valueSet.stream().map(option -> cloneAndEnrichValue(option, parameters)).map(ValueBuilder::build).collect(toSet());
}
Aggregations