Here you can find the source of getGetterFor(Field field)
public static Method getGetterFor(Field field)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Field; import java.lang.reflect.Method; public class Main { public static Method getGetterFor(Field field) { String name = field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); try {/* w ww . j a v a2s. c o m*/ return field.getDeclaringClass().getMethod("get" + name); } catch (NoSuchMethodException e) { return null; } } }