Here you can find the source of getMethodNames(Object obj, boolean hasParent)
public static String[] getMethodNames(Object obj, boolean hasParent) throws Exception
//package com.java2s; //License from project: Apache License import java.lang.reflect.Method; public class Main { public static String[] getMethodNames(Object obj, boolean hasParent) throws Exception { Method[] methods = getMethods(obj, hasParent); int len = methods.length; if (len < 1) { return null; }/*from w w w . java 2 s .c o m*/ String[] names = new String[len]; for (int i = 0; i < len; i++) { Method m = methods[i]; names[i] = m.getName(); } return names; } public static Method[] getMethods(Object obj, boolean hasParent) throws Exception { if (isEmpty(obj)) { return null; } if (hasParent) return obj.getClass().getMethods(); return obj.getClass().getDeclaredMethods(); } public static boolean isEmpty(Object obj) throws Exception { return obj == null; } }