Here you can find the source of getSetterMethod(Class> clazz, String name)
public static Method getSetterMethod(Class<?> clazz, String name)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; public class Main { public static Method getSetterMethod(Class<?> clazz, String name) { String methodName = convertToMehtodName("set", name); Method method = null;/* w w w . j a v a2 s. c o m*/ try { method = clazz.getMethod(methodName, String.class); } catch (Exception e) { throw new RuntimeException("get method exception - ", e); } return method; } public static String convertToMehtodName(String getterOrSetter, String name) { String methodName = ""; if (name != null && !name.equals("")) { String first = name.substring(0, 1); methodName = getterOrSetter + first.toUpperCase(); if (name.length() > 1) { methodName = methodName + name.substring(1); } } return methodName; } }