private ELResolver createELResolver() { this.instantiated = true; if (this.resolver == null) { CompositeELResolver r = new CompositeELResolver(); r.add(new ImplicitObjectELResolver()); for (Iterator itr = this.resolvers.iterator(); itr.hasNext();) { r.add((ELResolver) itr.next()); } r.add(new MapELResolver()); r.add(new ResourceBundleELResolver()); r.add(new ListELResolver()); r.add(new ArrayELResolver()); r.add(new BeanELResolver()); r.add(new ScopedAttributeELResolver()); this.resolver = r; } return this.resolver; }
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()); } ELResolver streamELResolver = getExpressionFactory(this).getStreamELResolver(); if (streamELResolver != null) { celResolver.add(streamELResolver); } celResolver.add(new StaticFieldELResolver()); 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; }
public static ELResolver getDefaultResolver() { if (Constants.IS_SECURITY_ENABLED) { CompositeELResolver defaultResolver = new CompositeELResolver(); defaultResolver.add(new MapELResolver()); defaultResolver.add(new ResourceBundleELResolver()); defaultResolver.add(new ListELResolver()); defaultResolver.add(new ArrayELResolver()); defaultResolver.add(new BeanELResolver()); return defaultResolver; } else { return DefaultResolver; } }
@Override public ELResolver getELResolver() { if (elResolver == null) { final CompositeELResolver resolver = new CompositeELResolver(); customResolver = new CompositeELResolver(); resolver.add(customResolver); resolver.add(factory.getStreamELResolver()); resolver.add(new StaticFieldELResolver()); resolver.add(new MapELResolver()); resolver.add(new ResourceBundleELResolver()); resolver.add(new ListELResolver()); resolver.add(new ArrayELResolver()); resolver.add(new BeanELResolverEx()); elResolver = resolver; } return elResolver; }
private CompositeELResolver createELResolver(ConstantResolver constantResolver) { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(constantResolver); resolver.add(beanManager.getELResolver()); FacesContext facesContext = FacesContext.getCurrentInstance(); if (facesContext != null) { resolver.add(facesContext.getELContext().getELResolver()); } resolver.add(new MapELResolver()); resolver.add(new ListELResolver()); resolver.add(new ArrayELResolver()); resolver.add(new ResourceBundleELResolver()); resolver.add(new BeanELResolver()); return resolver; }
private ELResolver createELResolver() { this.instantiated = true; if (this.resolver == null) { CompositeELResolver r = new CompositeELResolver(); r.add(new ImplicitObjectELResolver()); for (Iterator<ELResolver> itr = this.resolvers.iterator(); itr.hasNext();) { r.add(itr.next()); } r.add(new MapELResolver()); r.add(new ResourceBundleELResolver()); r.add(new ListELResolver()); r.add(new ArrayELResolver()); r.add(new BeanELResolver()); r.add(new ScopedAttributeELResolver()); this.resolver = r; } return this.resolver; }
@Override public ELResolver getELResolver() { CompositeELResolver result = new CompositeELResolver(); result.add(new MapELResolver()); result.add(new ArrayELResolver()); result.add(new ListELResolver()); result.add(new BeanELResolver()); return result; }
public Test() { Configuration configuration = new DefaultConfiguration() { public ResourceReader getResourceReader() { return new FileResourceReader(resourceDir, ".html"); } @Override public ELResolver getELResolver() { CompositeELResolver result = new CompositeELResolver(); result.add(new JsonElResolver()); result.add(super.getELResolver()); return result; } }; compiler = new FaceletsCompilerImp(configuration); }
private ELResolver createELResolver() { this.instantiated = true; if (this.resolver == null) { CompositeELResolver r = new JasperELResolver(this.resolvers); this.resolver = r; } return this.resolver; }
public static ELResolver getDefaultResolver() { if (Globals.IS_SECURITY_ENABLED) { ELResolver defaultResolver = new CompositeELResolver(); ((CompositeELResolver) defaultResolver).add(new MapELResolver()); ((CompositeELResolver) defaultResolver).add(new ResourceBundleELResolver()); ((CompositeELResolver) defaultResolver).add(new ListELResolver()); ((CompositeELResolver) defaultResolver).add(new ArrayELResolver()); ((CompositeELResolver) defaultResolver).add(new BeanELResolver()); return defaultResolver; } else { return DefaultResolver; } }
/** * Factory method to create the EL context */ protected ELContext createContext() { ELResolver resolver = new CompositeELResolver() { { add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanAndMethodELResolver()); } }; return new SimpleContext(resolver); }
@Override public ELResolver getELResolver() { if (resolver == null) { CompositeELResolver cr = new CompositeELResolver(); cr.add(new CompositeELResolver()); cr.add(new ResourceBundleELResolver()); cr.add(new MapELResolver(false)); cr.add(new SimpleResolver()); resolver = cr; } return resolver; }
protected static ELResolver createDefaultResolver() { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new VariableContextElResolver()); resolver.add(new ArrayELResolver(true)); resolver.add(new ListELResolver(true)); resolver.add(new MapELResolver(true)); resolver.add(new ResourceBundleELResolver()); resolver.add(new BeanELResolver()); return resolver; }
public SimpleELContext() { this.compositeELResolver = new CompositeELResolver(); this.compositeELResolver.add(new ArrayELResolver()); this.compositeELResolver.add(new ListELResolver()); this.compositeELResolver.add(new BeanELResolver()); this.compositeELResolver.add(new MapELResolver()); this.functionMapper = new ELFunctionMapper(); this.variableMapper = new ELVariableMapper(); this.expressionFactory = ExpressionFactory.newInstance(); }
/** * Get the EL resolver. The EL resolver is an EL resolver consisting of * a compound of the resolvers of all found bean managers. */ @Override public ELResolver getELResolver() { final CompositeELResolver resolver = new CompositeELResolver(); doWithBeanManagers((b) -> resolver.add(b.getELResolver())); resolver.add(delegate.getELResolver()); return resolver; }
@Override protected Object handleGetObject(String key) { String expression = wrapped.getString(key); SimpleContext context = new SimpleContext(); CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new IndirectResourceBundleELResolver(wrapped)); resolver.add(new ResourceBundleELResolver()); context.setELResolver(resolver); ValueExpression ve = factory.createValueExpression(context, expression, String.class); String value = (String) ve.getValue(context); return value; }
public LocalELContext(final ELContext context) { this.functionMapper = context.getFunctionMapper(); this.variableMapper = context.getVariableMapper(); CompositeELResolver elr = DEFAULT_RESOLVER; elr.add(context.getELResolver()); this.resolver = elr; }
@Produces @RequestScoped public ExtendedELContext createELContext() { ConstantResolver constantResolver = new ConstantResolver(); CompositeELResolver resolver = createELResolver(constantResolver); return createELContext(resolver, new FunctionMapperImpl(), new VariableMapperImpl(), constantResolver); }
public EsfingeELContext(FunctionMapper functionMapper, VariableMapper variableMapper, ELResolver ...resolvers){ this.functionMapper = functionMapper; this.variableMapper = variableMapper; elResolver = new CompositeELResolver(); for(ELResolver resolver : resolvers){ elResolver.add(resolver); } }
@Nonnull private static CompositeELResolver constructStandardElResolver() { final CompositeELResolver elResolver = new CompositeELResolver(); elResolver.add(new ArrayELResolver()); elResolver.add(new ListELResolver()); elResolver.add(new BeanELResolver()); elResolver.add(new MapELResolver()); return elResolver; }
/** * Creates an ELContext. * @param customResolvers resolvers to be added to the chain */ public ELContext newELContext(ELResolver... customResolvers) { CompositeELResolver composite = new CompositeELResolver(); for (ELResolver customResolver : customResolvers) { composite.add(customResolver); } composite.add(defaultELResolver); return new Context(composite); }
/** * @return a default ELResolver with functionality needed by all * expression evaluation. */ private ELResolver createDefaultELResolver() { CompositeELResolver resolver = new CompositeELResolver(); // Resolvers, in the order they will be most commonly accessed. // Moving JsonELResolver to the end makes JSON property resolution twice // as slow, so this is quite important. resolver.add(new JsonELResolver()); resolver.add(new MapELResolver()); resolver.add(new ListELResolver()); resolver.add(new ArrayELResolver()); // TODO: bean el resolver? return resolver; }
ElMetricName(ELResolver resolver, ExpressionFactory expressionFactory, Set<MetricsParameter> parameters) { super(parameters); CompositeELResolver composite = new CompositeELResolver(); composite.add(resolver); composite.add(new MapELResolver()); composite.add(new ListELResolver()); composite.add(new ArrayELResolver()); composite.add(new ResourceBundleELResolver()); composite.add(new BeanELResolver(true)); this.elResolver = composite; this.expressionFactory = expressionFactory; }
/** * {@inheritDoc} */ @Override public CompositeELResolver getELResolver() { return resolver; }
public static void main(final String[] args) { final FunctionMapper functionMapper = new LibraryFunctionMapperBuilder().add("proctor", ProctorRuleFunctions.class).build(); final ExpressionFactory expressionFactory = new ExpressionFactoryImpl(); final CompositeELResolver elResolver = new CompositeELResolver(); elResolver.add(new ArrayELResolver()); elResolver.add(new ListELResolver()); elResolver.add(new BeanELResolver()); elResolver.add(new MapELResolver()); final Map<String, Object> values = Maps.newLinkedHashMap(); values.put("countries", Sets.newHashSet("AA", "BB", "CC", "DD", "EE", "FF", "GG", "HH", "II", "JJ", "KK", "LL", "MM")); values.put("AA", "AA"); values.put("CC", "CC"); values.put("NN", "NN"); values.put("ZZ", "ZZ"); values.put("I1", 239235); values.put("I2", 569071142); values.put("I3", -189245); values.put("D1", 129835.12512); values.put("D2", -9582.9385); values.put("D3", 98982223.598731412); values.put("BT", Boolean.TRUE); values.put("BF", Boolean.FALSE); values.put("GLOOP", ""); final String[] expressions = { "${proctor:contains(countries, AA) || proctor:contains(countries, CC) || D2 < I3 && BF}", "${! proctor:contains(countries, ZZ) && I1 < I2 && empty GLOOP}", "${I2 - I3 + D3 - D1}", "${NN == '0' && ZZ == 'ZZ'}", "${BT != BF}", }; final int iterations = 100*1000; long elapsed = -System.currentTimeMillis(); for (int i = 0; i < iterations; i++) { final Map<String, ValueExpression> localContext = ProctorUtils.convertToValueExpressionMap(expressionFactory, values); final VariableMapper variableMapper = new MulticontextReadOnlyVariableMapper(localContext); final ELContext elContext = new ELContext() { @Override public ELResolver getELResolver() { return elResolver; } @Override public FunctionMapper getFunctionMapper() { return functionMapper; } @Override public VariableMapper getVariableMapper() { return variableMapper; } }; for (int j = 0; j < expressions.length; j++) { final ValueExpression ve = expressionFactory.createValueExpression(elContext, expressions[j], Object.class); final Object result = ve.getValue(elContext); if (i % 10000 == 0) { System.out.println(result); } } } elapsed += System.currentTimeMillis(); final int total = iterations * expressions.length; System.out.println(total + " expressions in " + elapsed + " ms (average " + (elapsed/(((double) total))) + " ms/expression)"); }