Package org.mule.mvel2.ast

Examples of org.mule.mvel2.ast.FunctionInstance


    public <T> T evaluate(String expression, MuleMessage message, Map<String, Object> vars)
    {
        MVELExpressionLanguageContext context = createExpressionLanguageContext();
        if (vars != null)
        {
            context.setNextFactory(new CachedMapVariableResolverFactory(vars,
                new DelegateVariableResolverFactory(staticContext, new MessageVariableResolverFactory(
                    parserConfiguration, muleContext, message, new DelegateVariableResolverFactory(
                        globalContext, createVariableVariableResolverFactory(message))))));
        }
        else
View Full Code Here


    {
        parserConfig.addImport(String.class);

        MuleBaseVariableResolverFactory resoverFactory = new MVELExpressionLanguageContext(parserConfig,
            muleContext);
        resoverFactory.setNextFactory(new MapVariableResolverFactory(Collections.singletonMap("foo", "val")));

        assertNotNull(resoverFactory.getVariableResolver("foo"));
        assertEquals("val", resoverFactory.getVariableResolver("foo").getValue());
        assertNull(resoverFactory.getVariableResolver("bar"));
    }
View Full Code Here

    @Test
    public void testGetVariableResolver()
    {
        MuleBaseVariableResolverFactory resoverFactory = new MVELExpressionLanguageContext(parserConfig,
            muleContext);
        resoverFactory.addResolver("foo", new SimpleValueResolver("val"));

        assertNotNull(resoverFactory.getVariableResolver("foo"));
        assertEquals("val", resoverFactory.getVariableResolver("foo").getValue());
        assertNull(resoverFactory.getVariableResolver("bar"));
    }
View Full Code Here

      else if (ptr instanceof MethodStub) {
        ctx = ((MethodStub) ptr).getClassReference();
        name = ((MethodStub) ptr).getMethodName();
      }
      else if (ptr instanceof FunctionInstance) {
        FunctionInstance func = (FunctionInstance) ptr;
        if (!name.equals(func.getFunction().getName())) {
          getBeanProperty(ctx, name);
          addAccessorNode(new DynamicFunctionAccessor(es));
        }
        else {
          addAccessorNode(new FunctionAccessor(func, es));
        }
        return func.call(ctx, thisRef, variableFactory, args);
      }
      else {
        throw new OptimizationFailure("attempt to optimize a method call for a reference that does not point to a method: "
            + name + " (reference is type: " + (ctx != null ? ctx.getClass().getName() : null) + ")");
      }
View Full Code Here

TOP

Related Classes of org.mule.mvel2.ast.FunctionInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.