use of org.mule.runtime.module.extension.internal.runtime.resolver.TypeSafeExpressionValueResolver in project mule by mulesoft.
the class ExtensionDefinitionParser method getExpressionBasedValueResolver.
/**
* Generates the {@link ValueResolver} for expression based values
*/
private ValueResolver getExpressionBasedValueResolver(MetadataType expectedType, String value, Set<ModelProperty> modelProperties, Class<?> expectedClass) {
ValueResolver resolver;
Optional<StackedTypesModelProperty> stackedTypesModelProperty = getStackedTypesModelProperty(modelProperties);
if (stackedTypesModelProperty.isPresent()) {
resolver = stackedTypesModelProperty.get().getValueResolverFactory().getExpressionBasedValueResolver(value, expectedClass);
// TODO MULE-13518: Add support for stacked value resolvers for @Parameter inside pojos // The following "IFs" should be removed once implemented
} else if (isParameterResolver(expectedType)) {
resolver = new ExpressionBasedParameterResolverValueResolver<>(value, expectedClass, expectedType);
} else if (isTypedValue(expectedType)) {
resolver = new ExpressionTypedValueValueResolver<>(value, expectedClass);
} else if (isLiteral(expectedType) || isTargetParameter(modelProperties)) {
resolver = new StaticLiteralValueResolver<>(value, expectedClass);
} else {
resolver = new TypeSafeExpressionValueResolver<>(value, expectedClass, expectedType);
}
return resolver;
}
Aggregations