static Method findMethod(Class<?> klass, String method, Class<?>[] paramTypes, Object[] params, boolean staticOnly) { return Util.findMethod(klass, method, paramTypes, params); }
static Method findMethod(Class<?> clazz, String methodName, Class<?>[] paramTypes, Object[] paramValues) { if (clazz == null || methodName == null) { throw new MethodNotFoundException( message(null, "util.method.notfound", clazz, methodName, paramString(paramTypes))); } if (paramTypes == null) { paramTypes = getTypesFromValues(paramValues); } Method[] methods = clazz.getMethods(); List<Wrapper> wrappers = Wrapper.wrap(methods, methodName); Wrapper result = findWrapper(clazz, wrappers, methodName, paramTypes, paramValues); return getMethod(clazz, (Method) result.unWrap()); }
static Constructor<?> findConstructor(Class<?> clazz, Class<?>[] paramTypes, Object[] paramValues) { String methodName = "<init>"; if (clazz == null) { throw new MethodNotFoundException( message(null, "util.method.notfound", null, methodName, paramString(paramTypes))); } if (paramTypes == null) { paramTypes = getTypesFromValues(paramValues); } Constructor<?>[] constructors = clazz.getConstructors(); List<Wrapper> wrappers = Wrapper.wrap(constructors); Wrapper result = findWrapper(clazz, wrappers, methodName, paramTypes, paramValues); return getConstructor(clazz, (Constructor<?>) result.unWrap()); }
private Method write(ELContext ctx) { if (this.write == null) { this.write = Util.getMethod(this.owner, descriptor.getWriteMethod()); if (this.write == null) { throw new PropertyNotWritableException(Util.message(ctx, "propertyNotWritable", new Object[] { owner.getName(), descriptor.getName() })); } } return this.write; }
Class<?> varType = mParamTypes[i].getComponentType(); for (int j = i; j < paramCount; j++) { if (!isAssignableFrom(paramTypes[j], varType)) { if (paramValues == null) { noMatch = true; break; } else { if (!isCoercibleFrom(paramValues[j], varType)) { noMatch = true; break; } else if (!isAssignableFrom(paramTypes[i], mParamTypes[i])) { if (paramValues == null) { noMatch = true; break; } else { if (!isCoercibleFrom(paramValues[i], mParamTypes[i])) { noMatch = true; break; match = resolveAmbiguousWrapper(candidates.keySet(), paramTypes); } else { match = null; throw new MethodNotFoundException(message( null, "util.method.ambiguous", clazz, name, paramString(paramTypes))); throw new MethodNotFoundException(message(
Util.findConstructor(clazz, paramTypes, params); Object[] parameters = Util.buildParameters( match.getParameterTypes(), match.isVarArgs(), params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(cause); } catch (ReflectiveOperationException e) { Util.findMethod(clazz, methodName, paramTypes, params); throw new MethodNotFoundException(Util.message(context, "staticFieldELResolver.methodNotFound", methodName, clazz.getName())); Object[] parameters = Util.buildParameters( match.getParameterTypes(), match.isVarArgs(), params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(cause);
@Override public void setValue(ELContext context, Object base, Object property, Object value) { Objects.requireNonNull(context); if (base != null && base.getClass().isArray()) { context.setPropertyResolved(base, property); if (this.readOnly) { throw new PropertyNotWritableException(Util.message(context, "resolverNotWriteable", base.getClass().getName())); } int idx = coerce(property); checkBounds(base, idx); if (value != null && !Util.isAssignableFrom(value.getClass(), base.getClass().getComponentType())) { throw new ClassCastException(Util.message(context, "objectNotAssignable", value.getClass().getName(), base.getClass().getComponentType().getName())); } Array.set(base, idx, value); } }
private BeanProperty get(ELContext ctx, String name) { BeanProperty property = this.properties.get(name); if (property == null) { throw new PropertyNotFoundException(Util.message(ctx, "propertyNotFound", type.getName(), name)); } return property; }
public static ExpressionFactory getExpressionFactory() { return Util.getExpressionFactory(); }
Util.findMethod(base.getClass(), methodName, paramTypes, params); Object[] parameters = Util.buildParameters( matchingMethod.getParameterTypes(), matchingMethod.isVarArgs(), params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(cause);
public boolean isReadOnly() { return this.write == null && (null == (this.write = Util.getMethod(this.owner, descriptor.getWriteMethod()))); }
static Constructor<?> getConstructor(Class<?> type, Constructor<?> c) { if (c == null || Modifier.isPublic(type.getModifiers())) { return c; } Constructor<?> cp = null; Class<?> sup = type.getSuperclass(); if (sup != null) { try { cp = sup.getConstructor(c.getParameterTypes()); cp = getConstructor(cp.getDeclaringClass(), cp); if (cp != null) { return cp; } } catch (NoSuchMethodException e) { // Ignore } } return null; }
@Override public Object getValue(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null || property == null) { return null; } context.setPropertyResolved(base, property); Method m = this.property(context, base, property).read(context); try { return m.invoke(base, (Object[]) null); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(Util.message(context, "propertyReadError", base.getClass().getName(), property.toString()), cause); } catch (Exception e) { throw new ELException(e); } }
Class<?> varType = mParamTypes[i].getComponentType(); for (int j = i; j < paramCount; j++) { if (!isAssignableFrom(paramTypes[j], varType)) { if (paramValues == null) { noMatch = true; break; } else { if (!isCoercibleFrom(paramValues[j], varType)) { noMatch = true; break; } else if (!isAssignableFrom(paramTypes[i], mParamTypes[i])) { if (paramValues == null) { noMatch = true; break; } else { if (!isCoercibleFrom(paramValues[i], mParamTypes[i])) { noMatch = true; break; match = resolveAmbiguousWrapper(candidates.keySet(), paramTypes); } else { match = null; throw new MethodNotFoundException(message( null, "util.method.ambiguous", clazz, name, paramString(paramTypes))); throw new MethodNotFoundException(message(
Util.findConstructor(clazz, paramTypes, params); Object[] parameters = Util.buildParameters( match.getParameterTypes(), match.isVarArgs(), params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(cause); Util.findMethod(clazz, methodName, paramTypes, params); throw new MethodNotFoundException(Util.message(context, "staticFieldELResolver.methodNotFound", methodName, clazz.getName())); Object[] parameters = Util.buildParameters( match.getParameterTypes(), match.isVarArgs(), params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(cause);
@Override public void setValue(ELContext context, Object base, Object property, Object value) { Objects.requireNonNull(context); if (base != null && base.getClass().isArray()) { context.setPropertyResolved(base, property); if (this.readOnly) { throw new PropertyNotWritableException(Util.message(context, "resolverNotWriteable", base.getClass().getName())); } int idx = coerce(property); checkBounds(base, idx); if (value != null && !Util.isAssignableFrom(value.getClass(), base.getClass().getComponentType())) { throw new ClassCastException(Util.message(context, "objectNotAssignable", value.getClass().getName(), base.getClass().getComponentType().getName())); } Array.set(base, idx, value); } }
private Method write(ELContext ctx) { if (this.write == null) { this.write = Util.getMethod(this.owner, descriptor.getWriteMethod()); if (this.write == null) { throw new PropertyNotWritableException(Util.message(ctx, "propertyNotWritable", new Object[] { owner.getName(), descriptor.getName() })); } } return this.write; }
private BeanProperty get(ELContext ctx, String name) { BeanProperty property = this.properties.get(name); if (property == null) { throw new PropertyNotFoundException(Util.message(ctx, "propertyNotFound", type.getName(), name)); } return property; }
public static ExpressionFactory getExpressionFactory() { return Util.getExpressionFactory(); }
Util.findMethod(base.getClass(), methodName, paramTypes, params); Object[] parameters = Util.buildParameters( matchingMethod.getParameterTypes(), matchingMethod.isVarArgs(), params); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); Util.handleThrowable(cause); throw new ELException(cause);