Here you can find the source of getGetters(Class> clazz)
public static Map<String, Method> getGetters(Class<?> clazz)
//package com.java2s; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.LinkedHashMap; import java.util.Map; public class Main { public static Map<String, Method> getGetters(Class<?> clazz) { Map<String, Method> map = new LinkedHashMap<String, Method>(); Class<?> searchType = clazz; while (searchType != null && searchType != Object.class) { Method[] methods = (searchType.isInterface()) ? new Method[0] : searchType.getDeclaredMethods(); for (Method method : methods) { String name = method.getName(); int modifiers = method.getModifiers(); if (modifiers - Modifier.PUBLIC == 0 && method.getParameterTypes().length == 0) { method.setAccessible(true); if (name.length() > 3 && name.startsWith("get")) { name = Character.toLowerCase(name.charAt(3)) + name.substring(4, name.length()); map.put(name, method); } else if (name.length() > 2 && name.startsWith("is")) { name = Character.toLowerCase(name.charAt(2)) + name.substring(3, name.length()); map.put(name, method); }// w w w .j a v a 2s . c o m } } searchType = searchType.getSuperclass(); } return map; } }