Search in sources :

Example 1 with TypeSafeExpressionValueResolver

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;
}
Also used : StackedTypesModelProperty.getStackedTypesModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.stackabletypes.StackedTypesModelProperty.getStackedTypesModelProperty) StackedTypesModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.stackabletypes.StackedTypesModelProperty) ExpressionBasedParameterResolverValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionBasedParameterResolverValueResolver) StaticValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.StaticValueResolver) ExpressionTypedValueValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionTypedValueValueResolver) NativeQueryParameterValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.NativeQueryParameterValueResolver) ValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ValueResolver) ProcessorChainValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ProcessorChainValueResolver) TypeSafeExpressionValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.TypeSafeExpressionValueResolver) StaticLiteralValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.StaticLiteralValueResolver) StaticLiteralValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.StaticLiteralValueResolver) ExpressionBasedParameterResolverValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionBasedParameterResolverValueResolver) TypeSafeExpressionValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.TypeSafeExpressionValueResolver)

Aggregations

StackedTypesModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.stackabletypes.StackedTypesModelProperty)1 StackedTypesModelProperty.getStackedTypesModelProperty (org.mule.runtime.module.extension.internal.loader.java.property.stackabletypes.StackedTypesModelProperty.getStackedTypesModelProperty)1 ExpressionBasedParameterResolverValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionBasedParameterResolverValueResolver)1 ExpressionTypedValueValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.ExpressionTypedValueValueResolver)1 NativeQueryParameterValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.NativeQueryParameterValueResolver)1 ProcessorChainValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.ProcessorChainValueResolver)1 StaticLiteralValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.StaticLiteralValueResolver)1 StaticValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.StaticValueResolver)1 TypeSafeExpressionValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.TypeSafeExpressionValueResolver)1 ValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.ValueResolver)1