Here you can find the source of getSetterMethod(Class beanClass, String fieldName, List
private static Method getSetterMethod(Class beanClass, String fieldName, List<Class> supportedTypes)
//package com.java2s; /* $This file is distributed under the terms of the license in /doc/license.txt$ */ import java.lang.reflect.Method; import java.util.List; public class Main { private static Method getSetterMethod(Class beanClass, String fieldName, List<Class> supportedTypes) { for (Class clazz : supportedTypes) { try { Class[] argList = new Class[1]; argList[0] = clazz;// w w w. j a v a 2 s. c o m return beanClass.getMethod("set" + fieldName, argList); } catch (NoSuchMethodException nsme) { // just try the next type } } return null; } }