Here you can find the source of getSetter(Class
public static <T> Method getSetter(Class<T> cls, final String fieldName)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; public class Main { public static <T> Method getSetter(Class<T> cls, final String fieldName) { for (final Method method : cls.getMethods()) { // method must start with "set" and have only one parameter, matching the // specified fieldType if (method.getName().equalsIgnoreCase("set" + fieldName) && method.getParameters().length == 1) { if (!method.isAccessible()) { method.setAccessible(true); }/*from w w w . j a v a 2 s .c o m*/ return method; } } return null; } }