Here you can find the source of getGetters(Object obj)
public static List<Method> getGetters(Object obj)
//package com.java2s; //License from project: Open Source License import java.lang.reflect.*; import java.util.*; public class Main { public static List<Method> getGetters(Object obj) { List<Method> ret = new ArrayList<Method>(); for (Method method : obj.getClass().getMethods()) { int mod = method.getModifiers(); if (Modifier.isStatic(mod) || !Modifier.isPublic(mod)) continue; if (method.getParameterTypes().length != 0) continue; String name = method.getName(); if (!(name.startsWith("get") || name.startsWith("is") || name.startsWith("has"))) continue; if (name.startsWith("has") && !(name.length() > 3 && Character.isUpperCase(name.charAt(3)))) continue; if (name.equals("getClass")) continue; ret.add(method);/*w w w .ja v a 2 s.co m*/ } return ret; } }