public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) { return returnType == null ? value : bindings.convert(value, returnType); }
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) { return returnType == null ? value : bindings.convert(value, returnType); }
/** * evaluate and return the (optionally coerced) result. */ public final Object getValue(Bindings bindings, ELContext context, Class<?> type) { Object value = eval(bindings, context); if (type != null) { value = bindings.convert(value, type); } return value; }
public Object eval(Bindings bindings, ELContext context, AstNode left, AstNode right) { Boolean l = bindings.convert(left.eval(bindings, context), Boolean.class); return Boolean.TRUE.equals(l) ? bindings.convert(right.eval(bindings, context), Boolean.class) : Boolean.FALSE; } @Override public String toString() { return "&&"; }
public Object eval(Bindings bindings, ELContext context, AstNode left, AstNode right) { Boolean l = bindings.convert(left.eval(bindings, context), Boolean.class); return Boolean.TRUE.equals(l) ? bindings.convert(right.eval(bindings, context), Boolean.class) : Boolean.FALSE; } @Override public String toString() { return "&&"; }
public Object eval(Bindings bindings, ELContext context, AstNode left, AstNode right) { Boolean l = bindings.convert(left.eval(bindings, context), Boolean.class); return Boolean.TRUE.equals(l) ? Boolean.TRUE : bindings.convert(right.eval(bindings, context), Boolean.class); } @Override public String toString() { return "||"; }
/** * evaluate and return the (optionally coerced) result. */ public final Object getValue(Bindings bindings, ELContext context, Class<?> type) { Object value = eval(bindings, context); if (type != null) { value = bindings.convert(value, type); } return value; }
public Object eval(Bindings bindings, ELContext context, AstNode left, AstNode right) { Boolean l = bindings.convert(left.eval(bindings, context), Boolean.class); return Boolean.TRUE.equals(l) ? Boolean.TRUE : bindings.convert(right.eval(bindings, context), Boolean.class); } @Override public String toString() { return "||"; }
@Override public Object eval(Bindings bindings, ELContext context) { StringBuilder b = new StringBuilder(16); for (int i = 0; i < getCardinality(); i++) { b.append(bindings.convert(nodes.get(i).eval(bindings, context), String.class)); } return b.toString(); }
@Override public Object eval(Bindings bindings, ELContext context) { StringBuilder b = new StringBuilder(16); for (int i = 0; i < getCardinality(); i++) { b.append(bindings.convert(nodes.get(i).eval(bindings, context), String.class)); } return b.toString(); }
@Override public Object eval(Bindings bindings, ELContext context) throws ELException { Boolean value = bindings.convert(question.eval(bindings, context), Boolean.class); return value.booleanValue() ? yes.eval(bindings, context) : no.eval(bindings, context); }
@Override public Object eval(Bindings bindings, ELContext context) throws ELException { Boolean value = bindings.convert(question.eval(bindings, context), Boolean.class); return value.booleanValue() ? yes.eval(bindings, context) : no.eval(bindings, context); }
Object param = getParam(i).eval(bindings, context); if (param != null || types[i].isPrimitive()) { params[i] = bindings.convert(param, types[i]); Object elem = Array.get(param, i); if (elem != null || varargType.isPrimitive()) { Array.set(array, i, bindings.convert(elem, varargType)); array = Array.newInstance(varargType, 1); if (param != null || varargType.isPrimitive()) { Array.set(array, 0, bindings.convert(param, varargType)); Object param = getParam(varargIndex + i).eval(bindings, context); if (param != null || varargType.isPrimitive()) { Array.set(array, i, bindings.convert(param, varargType)); Object param = getParam(i).eval(bindings, context); if (param != null || types[i].isPrimitive()) { params[i] = bindings.convert(param, types[i]);
Object param = getParam(i).eval(bindings, context); if (param != null || types[i].isPrimitive()) { params[i] = bindings.convert(param, types[i]); Object elem = Array.get(param, i); if (elem != null || varargType.isPrimitive()) { Array.set(array, i, bindings.convert(elem, varargType)); array = Array.newInstance(varargType, 1); if (param != null || varargType.isPrimitive()) { Array.set(array, 0, bindings.convert(param, varargType)); Object param = getParam(varargIndex + i).eval(bindings, context); if (param != null || varargType.isPrimitive()) { Array.set(array, i, bindings.convert(param, varargType)); Object param = getParam(i).eval(bindings, context); if (param != null || types[i].isPrimitive()) { params[i] = bindings.convert(param, types[i]);
public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) { Object base = prefix.eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix)); } Object property = getProperty(bindings, context); if (property == null && strict) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(property, String.class); Method method = findMethod(name, base.getClass(), returnType, paramTypes); return new MethodInfo(method.getName(), method.getReturnType(), paramTypes); }
public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) { Object base = prefix.eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix)); } Object property = getProperty(bindings, context); if (property == null && strict) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(property, String.class); Method method = findMethod(name, base.getClass(), returnType, paramTypes); return new MethodInfo(method.getName(), method.getReturnType(), paramTypes); }
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) { Object base = prefix.eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix)); } Object property = getProperty(bindings, context); if (property == null && strict) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(property, String.class); Method method = findMethod(name, base.getClass(), returnType, paramTypes); try { return method.invoke(base, paramValues); } catch (IllegalAccessException e) { throw new ELException(LocalMessages.get("error.property.method.access", name, base.getClass())); } catch (IllegalArgumentException e) { throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e); } catch (InvocationTargetException e) { throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e.getCause()); } }
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) { Object base = prefix.eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix)); } Object property = getProperty(bindings, context); if (property == null && strict) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(property, String.class); Method method = findMethod(name, base.getClass(), returnType, paramTypes); try { return method.invoke(base, paramValues); } catch (IllegalAccessException e) { throw new ELException(LocalMessages.get("error.property.method.access", name, base.getClass())); } catch (IllegalArgumentException e) { throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e); } catch (InvocationTargetException e) { throw new ELException(LocalMessages.get("error.property.method.invocation", name, base.getClass()), e.getCause()); } }
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) { Object base = property.getPrefix().eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", property.getPrefix())); } Object method = property.getProperty(bindings, context); if (method == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(method, String.class); paramValues = params.eval(bindings, context); context.setPropertyResolved(false); Object result = context.getELResolver().invoke(context, base, name, paramTypes, paramValues); if (!context.isPropertyResolved()) { throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, base.getClass())); } // if (returnType != null && !returnType.isInstance(result)) { // should we check returnType for method invocations? // throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, base.getClass())); // } return result; }
public Object invoke(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes, Object[] paramValues) { Object base = property.getPrefix().eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", property.getPrefix())); } Object method = property.getProperty(bindings, context); if (method == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.method.notfound", "null", base)); } String name = bindings.convert(method, String.class); paramValues = params.eval(bindings, context); context.setPropertyResolved(false); Object result = context.getELResolver().invoke(context, base, name, paramTypes, paramValues); if (!context.isPropertyResolved()) { throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, base.getClass())); } // if (returnType != null && !returnType.isInstance(result)) { // should we check returnType for method invocations? // throw new MethodNotFoundException(LocalMessages.get("error.property.method.notfound", name, base.getClass())); // } return result; }