List of utility methods to do Reflection Method Name
Method | getMethod(Class> beanClass, String methodName, Class>[] types) get Method return beanClass.getDeclaredMethod(methodName, types);
|
java.lang.reflect.Method | getMethod(Class> c, String name) get Method Method _method = null; for (Method m : c.getMethods()) { if (m.getName().equalsIgnoreCase(name)) { _method = m; break; return _method; ... |
Method | getMethod(Class> c, String name) Get method by name (declared) for (Method m : c.getMethods()) { if (m.getName().equals(name)) return m; return null; |
Method | getMethod(Class> c, String name, Class>[] args) Get method from class Method m = null; while (true) { try { m = c.getDeclaredMethod(name, args); break; } catch (NoSuchMethodException e) { c = c.getSuperclass(); if (c == null) { ... |
Method | getMethod(Class> clazz, String methodName) get Method return clazz.getMethod(methodName, (Class<?>[]) null);
|
Method | getMethod(Class> clazz, String methodName, Class> fieldType) get Method String name = fieldType.getSimpleName(); if ("Boolean".equals(name)) { return clazz.getMethod(methodName, boolean.class); if ("Integer".equals(name)) { return clazz.getMethod(methodName, int.class); if ("Long".equals(name)) { ... |
Method | getMethod(Class> clazz, String methodName, Class>... arguments) Fail-safe getMethod. try { return clazz.getMethod(methodName, arguments); } catch (NoSuchMethodException e) { } catch (SecurityException e) { return null; |
Method | getMethod(Class> clazz, String methodName, Class>... params) get Method try { return clazz.getDeclaredMethod(methodName, params); } catch (NoSuchMethodException e) { throw new RuntimeException( String.format("Cannot find method (%s) on class (%s)", methodName, clazz.getCanonicalName()), e); |
Method | getMethod(Class> clazz, String methodName, Class>... params) Get a method from a class that has the specific paramaters if (!loadedMethods.containsKey(clazz)) { loadedMethods.put(clazz, new HashMap<String, Method>()); Map<String, Method> methods = loadedMethods.get(clazz); if (methods.containsKey(methodName)) { return methods.get(methodName); try { ... |
Method | getMethod(Class> clazz, String methodName, Class>... params) get Method try { return clazz.getDeclaredMethod(methodName, params); } catch (NoSuchMethodException e) { Class<?> superClass = clazz.getSuperclass(); if (superClass == null) { throw e; } else { return getMethod(superClass, methodName, params); ... |