/** * Returns the setter-method for the given field name or null if no setter exists. */ public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) { String setterName = buildSetterName(fieldName); try { // Using getMathods(), getMathod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); for(Method method : methods) { if(method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if(paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) { return method; } } } return null; } catch (SecurityException e) { throw LOG.unableToAccessMethod(setterName, clazz.getName()); } }
/** * Returns the setter-method for the given field name or null if no setter exists. */ public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) { String setterName = buildSetterName(fieldName); try { // Using getMathods(), getMathod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); for(Method method : methods) { if(method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if(paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) { return method; } } } return null; } catch (SecurityException e) { throw LOG.unableToAccessMethod(setterName, clazz.getName()); } }
String setterName = buildSetterName(fieldName); try {
String setterName = buildSetterName(fieldName); try {
/** * Returns the setter-method for the given field name or null if no setter exists. */ public static Method getSetter(String fieldName, Class<?> clazz, Class<?> fieldType) { String setterName = buildSetterName(fieldName); try { // Using getMathods(), getMathod(...) expects exact parameter type // matching and ignores inheritance-tree. Method[] methods = clazz.getMethods(); for(Method method : methods) { if(method.getName().equals(setterName)) { Class<?>[] paramTypes = method.getParameterTypes(); if(paramTypes != null && paramTypes.length == 1 && paramTypes[0].isAssignableFrom(fieldType)) { return method; } } } return null; } catch (SecurityException e) { throw LOG.unableToAccessMethod(setterName, clazz.getName()); } }
String setterName = buildSetterName(fieldName); try {