Package org.mule.mvel2.compiler

Examples of org.mule.mvel2.compiler.ExpressionCompiler


        {
            addAlias(alias.getKey(), alias.getValue());
        }
        for (Entry<String, Function> function : functions.entrySet())
        {
            addFinalVariable(function.getKey(), new FunctionInstance(function.getValue()));
        }
    }
View Full Code Here


    @Override
    public void declareFunction(String name, ExpressionLanguageFunction function)
    {
        try
        {
            addFinalVariable(name, new FunctionInstance(new MVELFunctionAdaptor(name, function,
                    new ParserContext(parserConfiguration))));
        }
        finally
        {
            // Clear AbstractParser.parserContext ThreadLocal once Function has been created.
View Full Code Here

        // Global functions defined in external file
        if (globalFunctionsFile != null)
        {
            try
            {
                globalFunctions.putAll(CompilerTools.extractAllDeclaredFunctions(new ExpressionCompiler(
                    IOUtils.getResourceAsString(globalFunctionsFile, getClass())).compile()));
            }
            catch (IOException e)
            {
                throw new InitialisationException(CoreMessages.failedToLoad(globalFunctionsFile), e, this);
            }
        }

        // Global functions defined in configuration file (take precedence over functions in file)
        globalFunctions.putAll(CompilerTools.extractAllDeclaredFunctions(new ExpressionCompiler(
            globalFunctionsString).compile()));
    }
View Full Code Here

    }

    @Override
    public VariableResolver getVariableResolver(String name)
    {
        VariableResolver vr = delegate.getVariableResolver(name);
        if (vr == null && next != null)
        {
            vr = next.getVariableResolver(name);
        }
        return vr;
View Full Code Here

    }

    @Override
    public VariableResolver getVariableResolver(String name)
    {
        VariableResolver variableResolver = variableResolvers.get(name);
        if (variableResolver != null)
        {
            return variableResolver;
        }
        else
View Full Code Here

    }

    @Override
    public VariableResolver createVariable(String name, Object value, Class<?> type)
    {
        VariableResolver vr = getVariableResolver(name);

        if (vr != null)
        {
            vr.setValue(value);
        }
        else
        {
            addResolver(name, vr = new MuleVariableResolver<Object>(name, value, type, null));
        }
View Full Code Here

    }

    @Override
    public VariableResolver getVariableResolver(String name)
    {
        VariableResolver variableResolver = super.getVariableResolver(name);
        // In order to allow aliases to use message context without requiring the creating of a
        // GlobalVariableResolver for each expression evaluation, we create a new resolver on the fly with
        // current context instead.
        if (variableResolver instanceof MuleAliasVariableResolver)
        {
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public <T> T getVariable(String name)
    {
        VariableResolver resolver = getVariableResolver(name);
        if (resolver != null)
        {
            return (T) resolver.getValue();
        }
        else
        {
            return null;
        }
View Full Code Here

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

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

TOP

Related Classes of org.mule.mvel2.compiler.ExpressionCompiler

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.