List of utility methods to do Reflection Method Name
Method | getMethod(String methodName, Class> klass) Retorna o metodo de uma determinada classe. for (Method method : klass.getDeclaredMethods()) { if (method.getName().equals(methodName)) { return method; return null; |
Method | getMethod(String methodName, Class> type) get Method try { Method method = type.getDeclaredMethod(methodName); if (!method.isAccessible()) { method.setAccessible(true); return method; } catch (Exception e) { throw new UnsupportedOperationException(String.format( ... |
Method | getMethod(String methodName, Class>[] paramTypes, Class> targetClass) get Method try { return targetClass.getDeclaredMethod(methodName, paramTypes); } catch (Exception e) { Class<?> superClass = targetClass.getSuperclass(); if (superClass == null || superClass.equals(Object.class)) { return null; return getMethod(methodName, paramTypes, superClass); ... |
Method | getMethod(String methodName, Class[] params) Returns the method object associated with the given method name. if (m_cwc == null) m_cwc = Class.forName("com.jeta.forms.components.colors.JETAColorWell"); return m_cwc.getMethod(methodName, params); |
Method | getMethod(String methodName, Method method, boolean fromComponentType) get Method if (method == null) { return null; try { Class<?> returnType = method.getReturnType(); if (fromComponentType) { returnType = returnType.getComponentType(); return returnType.getMethod(methodName); } catch (Exception ex) { return null; |
Method | getMethod(String name, Class> pojoClass) get Method StringBuffer getMethodName = new StringBuffer(GET); getMethodName.append(name.substring(0, 1).toUpperCase()); getMethodName.append(name.substring(1)); return pojoClass.getMethod(getMethodName.toString(), new Class[] {}); |
String | getMethod(String name, Method method) get Method if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == boolean.class) { if (name.length() > 1) { return "is" + Character.toUpperCase(name.charAt(0)) + name.substring(1); } else { return "is" + Character.toUpperCase(name.charAt(0)); if (name.length() > 1) { ... |
Method | getMethod(String name, String methodDesc, Class actual) get Method try { return actual.getMethod(name, argumentStringToClassArray(methodDesc, actual)); } catch (Exception e) { throw new RuntimeException(e); |
Method | getMethod(String strMethodPrefix, A instance, String strAttributeName, Class> clazz) Gets the method. String strFirstLetter = strAttributeName.substring(0, 1).toUpperCase(); String strMethodName = strMethodPrefix + strFirstLetter + strAttributeName.substring(1, strAttributeName.length()); try { return instance.getClass().getMethod(strMethodName, new Class[] { clazz }); } catch (NoSuchMethodException e) { return getPrimitiveMethod(strMethodName, instance, clazz); |
Method | getMethodAsAccessible(String methodName, Class get Method As Accessible for (Method each : clazz.getDeclaredMethods()) { Method result = methodIsCorrectOrNull(methodName, each); if (result != null) return result; for (Method each : clazz.getSuperclass().getDeclaredMethods()) { Method result = methodIsCorrectOrNull(methodName, each); if (result != null) ... |