Refine search
/** * Evaluates an EL expression. * @param expression The EL expression to be evaluated. * @return The result of the expression evaluation. */ public Object eval(String expression) { return getValue(expression, Object.class); }
/** * Evaluates an EL expression, and coerces the result to the specified type. * @param expression The EL expression to be evaluated. * @param expectedType Specifies the type that the resultant evaluation * will be coerced to. * @return The result of the expression evaluation. */ public Object getValue(String expression, Class<?> expectedType) { ValueExpression exp = factory.createValueExpression( elManager.getELContext(), bracket(expression), expectedType); return exp.getValue(elManager.getELContext()); }
Class<?>[] paramTypes = new Class<?>[params.length]; for (int i = 0; i < params.length; i++) { paramTypes[i] = toClass(params[i], loader); function = method; elManager.mapFunction(prefix, function, meth);
/** * Assign an EL expression to an EL variable. The expression is parsed, * but not evaluated, and the parsed expression is mapped to the EL * variable in the local variable map. * Any previously assigned expression to the same variable will be replaced. * If the expression is <code>null</code>, the variable will be removed. * @param var The name of the variable. * @param expression The EL expression to be assigned to the variable. */ public void setVariable(String var, String expression) { ValueExpression exp = factory.createValueExpression( elManager.getELContext(), bracket(expression), Object.class); elManager.setVariable(var, exp); }
public Object getValue(String expression, Class<?> expectedType) { ValueExpression ve = factory.createValueExpression( context, bracket(expression), expectedType); return ve.getValue(context); }
public static String process(String data, Map<String, ?> parameters) { ELProcessor eLProcessor = new ELProcessor(); parameters.entrySet().forEach(e -> eLProcessor.defineBean(e.getKey(), e.getValue())); ELContext eLContext = eLProcessor.getELManager().getELContext(); ValueExpression valueExpression = ExpressionFactory.newInstance() .createValueExpression(eLContext, data, String.class); return (String) valueExpression.getValue(eLContext); }
public void setVariable(String variable, String expression) { if (expression == null) { manager.setVariable(variable, null); } else { ValueExpression ve = factory.createValueExpression( context, bracket(expression), Object.class); manager.setVariable(variable, ve); } }
public static ELProcessor getELProcessor(String name, Object bean) { ELProcessor elProcessor = new ELProcessor(); elProcessor.defineBean(name, bean); return elProcessor; }
StandardELContext context = processor.getELManager().getELContext(); processor.defineBean(partName, lastMap); processor.defineBean(variable.getName(), variable.getValue());
@Override public void init(HttpServletRequest request) { Object weldInitialListener = request.getServletContext().getAttribute("org.jboss.weld.servlet.WeldInitialListener"); ServletRequestEvent event = new ServletRequestEvent(request.getServletContext(), request); ELProcessor elProcessor = new ELProcessor(); elProcessor.defineBean("weldInitialListener", weldInitialListener); elProcessor.defineBean("event", event); elProcessor.eval("weldInitialListener.requestInitialized(event)"); }
private ELProcessor getElProcessor(InvocationContext invocationContext, HttpMessageContext httpMessageContext) { ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(beanManager.getELResolver()); elProcessor.defineBean("self", invocationContext.getTarget()); elProcessor.defineBean("httpMessageContext", httpMessageContext); return elProcessor; }
JavaxElMetricStrategy(Class<?> clazz) { processor = new ELProcessor(); processor.getELManager().importClass(clazz.getName()); }
private String evaluateCompositeExpression(Matcher matcher) { StringBuffer buffer = new StringBuffer(); do { Object result = processor.eval(matcher.group(1)); matcher.appendReplacement(buffer, result != null ? String.valueOf(result) : ""); } while (matcher.find()); matcher.appendTail(buffer); return buffer.toString(); } }
public static ELProcessor getELProcessor() { ELProcessor elProcessor = new ELProcessor(); elProcessor.getELManager().addELResolver(getBeanManager().getELResolver()); return elProcessor; }
/** * Constructs an {@link ExpressionEvaluator} with the specified {@link Variable}s. * * @param variables the {@link Variables} */ public ExpressionEvaluator(Variables variables) { // create an ELProcessor that we'll use to perform the evaluation processor = new ELProcessor(); // add all of the variables to the processor (to create a context) for (Variable variable : variables) { defineVariable(variable); } }
/** * Assign an EL expression to an EL variable. The expression is parsed, * but not evaluated, and the parsed expression is mapped to the EL * variable in the local variable map. * Any previously assigned expression to the same variable will be replaced. * If the expression is <code>null</code>, the variable will be removed. * @param var The name of the variable. * @param expression The EL expression to be assigned to the variable. */ public void setVariable(String var, String expression) { ValueExpression exp = factory.createValueExpression( elManager.getELContext(), bracket(expression), Object.class); elManager.setVariable(var, exp); }
public Object getValue(String expression, Class<?> expectedType) { ValueExpression ve = factory.createValueExpression( context, bracket(expression), expectedType); return ve.getValue(context); }
public static String process(String data, Map<String, ?> parameters) { ELProcessor eLProcessor = new ELProcessor(); parameters.entrySet().forEach(e -> eLProcessor.defineBean(e.getKey(), e.getValue())); ELContext eLContext = eLProcessor.getELManager().getELContext(); ValueExpression valueExpression = ExpressionFactory.newInstance() .createValueExpression(eLContext, data, String.class); return (String) valueExpression.getValue(eLContext); }
public void setVariable(String variable, String expression) { if (expression == null) { manager.setVariable(variable, null); } else { ValueExpression ve = factory.createValueExpression( context, bracket(expression), Object.class); manager.setVariable(variable, ve); } }
public static ELProcessor getELProcessor(String name1, Object bean1, String name2, Object bean2) { ELProcessor elProcessor = new ELProcessor(); elProcessor.defineBean(name1, bean1); elProcessor.defineBean(name2, bean2); return elProcessor; }