Here you can find the source of getSetterMethod(String setterName, Object bean, Class> setterParamType)
public static Method getSetterMethod(String setterName, Object bean, Class<?> setterParamType)
//package com.java2s; /*/*from w ww . ja v a 2s . c o m*/ Milyn - Copyright (C) 2006 - 2010 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1) as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details: http://www.gnu.org/licenses/lgpl.txt */ import java.lang.reflect.Method; public class Main { public static Method getSetterMethod(String setterName, Object bean, Class<?> setterParamType) { return getSetterMethod(setterName, bean.getClass(), setterParamType); } public static Method getSetterMethod(String setterName, Class beanclass, Class<?> setterParamType) { Method[] methods = beanclass.getMethods(); for (Method method : methods) { if (method.getName().equals(setterName)) { Class<?>[] params = method.getParameterTypes(); if (params != null && params.length == 1 && params[0].isAssignableFrom(setterParamType)) { return method; } } } return null; } }