Example usage for javax.el CompositeELResolver add

List of usage examples for javax.el CompositeELResolver add

Introduction

In this page you can find the example usage for javax.el CompositeELResolver add.

Prototype

public void add(ELResolver elResolver) 

Source Link

Usage

From source file:com.github.htfv.maven.plugins.buildconfigurator.core.el.BuildConfiguratorELResolver.java

/**
 * Creates a new instance of EL resolver which may be used for expression
 * evaluation. Returned resolver includes not only
 * {@code BuildConfiguratorELResolver}, but also all standard resolvers.
 *
 * @param mavenProject//from   w ww.  j av a 2  s .  c  o m
 *            reference to the configured Maven project. Used to resolve
 *            properties referenced in EL expressions.
 * @param configuration
 *            loaded property files.
 *
 * @return new instance of EL resolver.
 */
public static ELResolver newInstance(final MavenProject mavenProject, final Configuration configuration) {
    final CompositeELResolver elResolver = new CompositeELResolver();

    elResolver.add(new BuildConfiguratorELResolver(mavenProject, configuration));
    elResolver.add(new ArrayELResolver());
    elResolver.add(new ListELResolver());
    elResolver.add(new MapELResolver());
    elResolver.add(new ResourceBundleELResolver());

    //
    // BeanELResolver should be the last one.
    //

    elResolver.add(new BeanELResolver());

    return elResolver;
}

From source file:biz.netcentric.cq.tools.actool.configreader.YamlMacroElEvaluator.java

public YamlMacroElEvaluator() {

    try {// w w w  . j  av  a 2  s.  c  om
        Class<?> expressionFactoryClass = getClass().getClassLoader()
                .loadClass("org.apache.el.ExpressionFactoryImpl");
        expressionFactory = (ExpressionFactory) expressionFactoryClass.newInstance();
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        throw new IllegalStateException("Could not init EL: " + e);
    }

    final VariableMapper variableMapper = new ElVariableMapper();
    final ElFunctionMapper functionMapper = new ElFunctionMapper();
    final CompositeELResolver compositeELResolver = new CompositeELResolver();

    compositeELResolver.add(new BaseELResolver());
    compositeELResolver.add(new ArrayELResolver());
    compositeELResolver.add(new ListELResolver());
    compositeELResolver.add(new BeanELResolver());
    compositeELResolver.add(new MapELResolver());
    context = new ELContext() {
        @Override
        public ELResolver getELResolver() {
            return compositeELResolver;
        }

        @Override
        public FunctionMapper getFunctionMapper() {
            return functionMapper;
        }

        @Override
        public VariableMapper getVariableMapper() {
            return variableMapper;
        }
    };

}

From source file:org.tinygroup.jspengine.runtime.PageContextImpl.java

private ELResolver getELResolver() {

    if (elResolver == null) {
        // Create a CompositeELResolver
        CompositeELResolver celResolver = new CompositeELResolver();

        celResolver.add(new ImplicitObjectELResolver());
        // Add ELResolvers registered in JspApplicationContext
        JspApplicationContextImpl jaContext = getJspApplicationContext();
        Iterator<ELResolver> it = jaContext.getELResolvers();
        while (it.hasNext()) {
            celResolver.add(it.next());/*w w  w. j av  a  2 s.c  o  m*/
        }
        celResolver.add(new MapELResolver());
        celResolver.add(new ResourceBundleELResolver());
        celResolver.add(new ListELResolver());
        celResolver.add(new ArrayELResolver());
        celResolver.add(new BeanELResolver());
        celResolver.add(new ScopedAttributeELResolver());
        elResolver = celResolver;
    }
    return elResolver;
}

From source file:therian.Therian.java

public TherianContext contextFor(ELContext wrapped) {
    final TherianContext result = new TherianContext(new ELContextWrapper(wrapped) {

        @Override/*  w w  w  .ja v a 2 s . c  om*/
        protected ELResolver wrap(ELResolver elResolver) {
            final CompositeELResolver compositeResolver = new CompositeELResolver();
            for (TherianModule module : modules) {
                for (ELResolver configuredELResolver : module.getElResolvers()) {
                    compositeResolver.add(configuredELResolver);
                }
            }
            compositeResolver.add(elResolver);
            return compositeResolver;
        }
    }, operatorManager);
    result.putContext(Therian.class, this);

    final ELContextEvent event = new ELContextEvent(result);
    for (TherianModule module : modules) {
        for (ELContextListener listener : module.getElContextListeners()) {
            listener.contextCreated(event);
        }
    }
    return result;
}