static Constructor<?> findConstructor(Class<?> klass, Class<?>[] paramTypes, Object[] params) { if (paramTypes != null) { try { Constructor<?> c = klass.getConstructor(paramTypes); if (Modifier.isPublic(c.getModifiers())) { return c; } } catch (java.lang.NoSuchMethodException ex) { } throw new MethodNotFoundException("The constructor for class " + klass + " not found or accessible"); } int paramCount = (params == null)? 0: params.length; for (Constructor<?> c: klass.getConstructors()) { if (c.isVarArgs() || c.getParameterTypes().length==paramCount) { return c; } } throw new MethodNotFoundException("The constructor for class " + klass + " not found"); }
static Method findMethod(Class<?> klass, String method, Class<?>[] paramTypes, Object[] params, boolean staticOnly) { if (paramTypes != null) { try { Method m = klass.getMethod(method, paramTypes); int mod = m.getModifiers(); if (Modifier.isPublic(mod) && (!staticOnly || Modifier.isStatic(mod))) { return m; } } catch (java.lang.NoSuchMethodException ex) { } throw new MethodNotFoundException("Method " + method + "for class " + klass + " not found or accessible"); } int paramCount = (params == null)? 0: params.length; for (Method m: klass.getMethods()) { if (m.getName().equals(method) && ( m.isVarArgs() || m.getParameterTypes().length==paramCount)){ return m; } } throw new MethodNotFoundException("Method " + method + " not found"); }
private Method findMethod(Object base, String method, Class<?>[] paramTypes, Object[] params) { Class<?>beanClass = base.getClass(); if (paramTypes != null) { try { return beanClass.getMethod(method, paramTypes); } catch (java.lang.NoSuchMethodException ex) { throw new MethodNotFoundException(ex); } } int paramCount = (params == null)? 0: params.length; for (Method m: base.getClass().getMethods()) { if (m.getName().equals(method) && ( m.isVarArgs() || m.getParameterTypes().length==paramCount)){ return m; } } throw new MethodNotFoundException("Method " + method + " not found"); }
@Override public void save() throws RegistryException { throw new MethodNotFoundException(); }
@Override public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) { if (method == null || RESTRICTED_METHODS.contains(method.toString())) { throw new MethodNotFoundException("Cannot find method '" + method + "' in " + base.getClass()); } Object result = super.invoke(context, base, method, paramTypes, params); if (result instanceof Class) { throw new MethodNotFoundException("Cannot find method '" + method + "' in " + base.getClass()); } return result; }
static Method findMethod(Class<?> klass, String method, Class<?>[] paramTypes, Object[] params, boolean staticOnly) { Method m = findMethod(klass, method, paramTypes, params); if (staticOnly && !Modifier.isStatic(m.getModifiers())) { throw new MethodNotFoundException("Method " + method + "for class " + klass + " not found or accessible"); } return m; }
protected Method findMethodOrThrow(final String methodName, final Class<?>[] paramTypes, final Object[] params, final boolean staticOnly, final Map<String, List<MethodDescriptor>> methodDescriptors) { final Method method = findMethod(methodName, paramTypes, params, staticOnly, methodDescriptors); if (method == null) { throw new MethodNotFoundException("Method " + methodName + " for bean class " + "not found or accessible"); } return method; }
static Method findMethod(Class<?> klass, String method, Class<?>[] paramTypes, Object[] params, boolean staticOnly) { Method m = findMethod(klass, method, paramTypes, params); if (staticOnly && !Modifier.isStatic(m.getModifiers())) { throw new MethodNotFoundException("Method " + method + "for class " + klass + " not found or accessible"); } return m; }
protected Method findMethodOrThrow(final String methodName, final Class<?>[] paramTypes, final Object[] params, final boolean staticOnly, final MethodDescriptor[] methodDescriptors) { final Method method = findMethod(methodName, paramTypes, params, staticOnly, methodDescriptors); if (method == null) { throw new MethodNotFoundException("Method " + methodName + "for bean class " + "not found or accessible"); } return method; }
protected Method findMethodOrThrow(final Class<?> klass, final String methodName, final Class<?>[] paramTypes, final Object[] params, final boolean staticOnly) { final Method method = findMethod(klass, methodName, paramTypes, params, staticOnly); if (method == null) { throw new MethodNotFoundException("Method " + methodName + "for class " + klass + " not found or accessible"); } return method; }
private <T> T invoke(Invoker<T> invoker) { try { return invoker.invoke(); } catch (javax.faces.el.MethodNotFoundException e) { throw new MethodNotFoundException(e.getMessage(), e); } catch (EvaluationException e) { throw new ELException(e.getMessage(), e); } }
public MethodInfo getMethodInfo(ELContext context) { try { return this.orig.getMethodInfo(context); } catch (PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
@Override public MethodInfo getMethodInfo(final ELContext context) { try { return this.orig.getMethodInfo(context); } catch (final PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (final MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (final ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
@Override public MethodInfo getMethodInfo(ELContext context) { try { return this.orig.getMethodInfo(context); } catch (PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
public MethodInfo getMethodInfo(ELContext context) { try { return this.orig.getMethodInfo(context); } catch (PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
public Object invoke(ELContext context, Object[] params) { try { return this.orig.invoke(context, params); } catch (PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
public Object invoke(ELContext context, Object[] params) { try { return this.orig.invoke(context, params); } catch (PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
@Override public Object invoke(ELContext context, Object[] params) { try { return this.orig.invoke(context, params); } catch (PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
@Override public MethodInfo getMethodInfo(ELContext context) { try { return this.orig.getMethodInfo(context); } catch (PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }
@Override public Object invoke(final ELContext context, final Object[] params) { try { return this.orig.invoke(context, params); } catch (final PropertyNotFoundException pnfe) { throw new PropertyNotFoundException(this.attr + ": " + pnfe.getMessage(), pnfe.getCause()); } catch (final MethodNotFoundException mnfe) { throw new MethodNotFoundException(this.attr + ": " + mnfe.getMessage(), mnfe.getCause()); } catch (final ELException e) { throw new ELException(this.attr + ": " + e.getMessage(), e.getCause()); } }