Class<?> cls = classForName(className); try { Method m = cls.getMethod(methodName, new Class[] {}); T t = (T) m.invoke(null, new Object[] {}); if (t == null) { return t; if (expectedClass.isAssignableFrom(t.getClass()) == false) { ...
try { Method method = cl.getDeclaredMethod(methodName, args); method.setAccessible(true); return method.invoke(null, parameter); } catch (Exception e) { e.printStackTrace(); if (isThrowable) { ...
try { Method method = clazz.getMethod(methodName); method.setAccessible(true); return (T) method.invoke(null, args); } catch (Exception e) { throw new RuntimeException(e);
final Method method = clazz.getMethod(methodName, argTypes); return method.invoke(null, args);
final Class<?> clazz = loader.loadClass(className); for (final Method method : clazz.getMethods()) { if (method.getName().equals(methodName) && doParametersMatch(method.getParameterTypes(), parameters)) { return (T) method.invoke(null, parameters); throw new NoSuchMethodException("No matching method found");
try { final Class<?> clazz = Class.forName(className); final Class<?> argumentClass = argument.getClass(); final Method method = clazz.getDeclaredMethod(methodName, argumentClass); return (O) method.invoke(null, argument); } catch (final Exception ex) { return handleReflectionException(ex);
return invokeStatic(cname, methodName, cl, EmptyClassArray, EmptyObjectArray);
Method method = null; try { method = staticClass.getMethod(methodName, parameterTypes); } catch (SecurityException e) { log.error("Can't get method " + methodName, e); return null; } catch (NoSuchMethodException e) { log.error("Can't get method " + methodName, e); ...
Object result = null; try { Class argClasses[] = null; if (args != null && args.length > 0) { argClasses = new Class[args.length]; for (int i = 0, max = args.length; i < max; i++) { argClasses[i] = (args[i] == null) ? null : args[i].getClass(); Method method = getMethod(objClass, methodName, argClasses); result = method.invoke(null, args); } catch (Exception e) { return result;
try { return getMethod(cls, method, params).invoke(null, args); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); ...