Java tutorial
//package com.java2s; //License from project: Open Source License import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; public class Main { @SuppressWarnings("rawtypes") private static List<Method> getMothds(Class clazz, boolean includeParentClass) { List<Method> list = new ArrayList<Method>(); Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { list.add(method); } if (includeParentClass) { getParentClassMothds(list, clazz.getSuperclass()); } return list; } @SuppressWarnings("rawtypes") private static List<Method> getParentClassMothds(List<Method> list, Class clazz) { Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { list.add(method); } if (clazz.getSuperclass() == Object.class) { return list; } getParentClassMothds(list, clazz.getSuperclass()); return list; } }