Search in sources :

Example 1 with CachedMapVariableResolverFactory

use of org.mule.mvel2.integration.impl.CachedMapVariableResolverFactory in project mule by mulesoft.

the class AbstractVarAssignmentDataTypePropagatorTestCase method createMvelExpressionLanguageContext.

protected MVELExpressionLanguageContext createMvelExpressionLanguageContext(PrivilegedEvent testEvent, PrivilegedEvent.Builder builder, ParserConfiguration parserConfiguration) {
    final MVELExpressionLanguageContext context = new MVELExpressionLanguageContext(parserConfiguration, muleContext);
    final StaticVariableResolverFactory staticContext = new StaticVariableResolverFactory(parserConfiguration, muleContext);
    final GlobalVariableResolverFactory globalContext = new GlobalVariableResolverFactory(emptyMap(), emptyMap(), parserConfiguration, muleContext);
    final DelegateVariableResolverFactory innerDelegate = new DelegateVariableResolverFactory(globalContext, new VariableVariableResolverFactory(parserConfiguration, muleContext, testEvent, builder));
    final DelegateVariableResolverFactory delegate = new DelegateVariableResolverFactory(staticContext, new MessageVariableResolverFactory(parserConfiguration, muleContext, testEvent, builder, innerDelegate));
    context.setNextFactory(new CachedMapVariableResolverFactory(emptyMap(), delegate));
    return context;
}
Also used : DelegateVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.DelegateVariableResolverFactory) MVELExpressionLanguageContext(org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguageContext) GlobalVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.GlobalVariableResolverFactory) MessageVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.MessageVariableResolverFactory) CachedMapVariableResolverFactory(org.mule.mvel2.integration.impl.CachedMapVariableResolverFactory) StaticVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.StaticVariableResolverFactory) VariableVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.VariableVariableResolverFactory)

Example 2 with CachedMapVariableResolverFactory

use of org.mule.mvel2.integration.impl.CachedMapVariableResolverFactory in project mule by mulesoft.

the class MVELExpressionLanguage method evaluateUntyped.

public <T> T evaluateUntyped(String expression, PrivilegedEvent event, PrivilegedEvent.Builder eventBuilder, ComponentLocation componentLocation, Map<String, Object> vars) {
    if (event == null) {
        return evaluateUntyped(expression, vars);
    }
    MVELExpressionLanguageContext context = createExpressionLanguageContext();
    final DelegateVariableResolverFactory innerDelegate = new DelegateVariableResolverFactory(globalContext, createVariableVariableResolverFactory(event, eventBuilder));
    final DelegateVariableResolverFactory delegate = new DelegateVariableResolverFactory(staticContext, new EventVariableResolverFactory(parserConfiguration, muleContext, event, eventBuilder, componentLocation, innerDelegate));
    if (vars != null) {
        context.setNextFactory(new CachedMapVariableResolverFactory(vars, delegate));
    } else {
        context.setNextFactory(delegate);
    }
    return evaluateInternal(expression, context);
}
Also used : CachedMapVariableResolverFactory(org.mule.mvel2.integration.impl.CachedMapVariableResolverFactory)

Example 3 with CachedMapVariableResolverFactory

use of org.mule.mvel2.integration.impl.CachedMapVariableResolverFactory in project mule by mulesoft.

the class AbstractVarExpressionDataTypeResolverTestCase method createMvelExpressionLanguageContext.

protected MVELExpressionLanguageContext createMvelExpressionLanguageContext(PrivilegedEvent testEvent, ParserConfiguration parserConfiguration) {
    final MVELExpressionLanguageContext context = new MVELExpressionLanguageContext(parserConfiguration, muleContext);
    final StaticVariableResolverFactory staticContext = new StaticVariableResolverFactory(parserConfiguration, muleContext);
    final GlobalVariableResolverFactory globalContext = new GlobalVariableResolverFactory(Collections.EMPTY_MAP, Collections.EMPTY_MAP, parserConfiguration, muleContext);
    final DelegateVariableResolverFactory innerDelegate = new DelegateVariableResolverFactory(globalContext, new VariableVariableResolverFactory(parserConfiguration, muleContext, testEvent, PrivilegedEvent.builder(testEvent)));
    final DelegateVariableResolverFactory delegate = new DelegateVariableResolverFactory(staticContext, new MessageVariableResolverFactory(parserConfiguration, muleContext, testEvent, PrivilegedEvent.builder(testEvent), innerDelegate));
    context.setNextFactory(new CachedMapVariableResolverFactory(Collections.EMPTY_MAP, delegate));
    return context;
}
Also used : DelegateVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.DelegateVariableResolverFactory) MVELExpressionLanguageContext(org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguageContext) GlobalVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.GlobalVariableResolverFactory) MessageVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.MessageVariableResolverFactory) CachedMapVariableResolverFactory(org.mule.mvel2.integration.impl.CachedMapVariableResolverFactory) StaticVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.StaticVariableResolverFactory) VariableVariableResolverFactory(org.mule.runtime.core.internal.el.mvel.VariableVariableResolverFactory)

Aggregations

CachedMapVariableResolverFactory (org.mule.mvel2.integration.impl.CachedMapVariableResolverFactory)3 DelegateVariableResolverFactory (org.mule.runtime.core.internal.el.mvel.DelegateVariableResolverFactory)2 GlobalVariableResolverFactory (org.mule.runtime.core.internal.el.mvel.GlobalVariableResolverFactory)2 MVELExpressionLanguageContext (org.mule.runtime.core.internal.el.mvel.MVELExpressionLanguageContext)2 MessageVariableResolverFactory (org.mule.runtime.core.internal.el.mvel.MessageVariableResolverFactory)2 StaticVariableResolverFactory (org.mule.runtime.core.internal.el.mvel.StaticVariableResolverFactory)2 VariableVariableResolverFactory (org.mule.runtime.core.internal.el.mvel.VariableVariableResolverFactory)2