Here you can find the source of getSetterMethodByFieldName(String fieldName, Field field)
public static Method getSetterMethodByFieldName(String fieldName, Field field)
//package com.java2s; /**/* w w w .j a va 2s .c om*/ * CC-LGPL 2.1 * http://creativecommons.org/licenses/LGPL/2.1/ */ import java.lang.reflect.Field; import java.lang.reflect.Method; public class Main { public static Method getSetterMethodByFieldName(String fieldName, Field field) { StringBuilder sb = new StringBuilder(fieldName.length() + 3); sb.append("set"); sb.append(fieldName); sb.setCharAt(3, Character.toUpperCase(sb.charAt(3))); try { return field.getDeclaringClass().getDeclaredMethod(sb.toString(), field.getType()); } catch (NoSuchMethodException e) { return null; } } }