Here you can find the source of getGetter(Class> clazz, Field field)
public static Method getGetter(Class<?> clazz, Field field)
//package com.java2s; //License from project: Apache License import java.lang.reflect.Field; import java.lang.reflect.Method; public class Main { public static Method getGetter(Class<?> clazz, Field field) { String filedName = field.getName(); String firstLetter = filedName.substring(0, 1).toUpperCase(); String getMethodName = "get" + firstLetter + filedName.substring(1); Method getMethod = null;/* w w w . j a v a 2s . co m*/ try { getMethod = clazz.getDeclaredMethod(getMethodName); } catch (Exception e) { } return getMethod; } }