获取字段的获取方法方法名称
/** 来自 nowjava**/ //package com.nowjava; import java.lang.reflect.Field; public class Main { public static String getGetterMethodNameForField(Object obj, Field field) { if (field.getType() == Boolean.class || field.getType() == boolean.class) { String isGetterName = "is" + field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1); try { obj.getClass().getDeclaredMethod(isGetterName); return isGetterName; } catch (NoSuchMethodException nsme) { } }