Java examples for Reflection:Field Get
get All Methods Include Super Class
//package com.java2s; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] argv) throws Exception { Class clazz = String.class; System.out.println(getAllMethodsIncludeSuperClass(clazz)); }/*from w w w.ja v a 2s.co m*/ public static List<Method> getAllMethodsIncludeSuperClass( final Class<?> clazz) { List<Method> lf = new ArrayList<Method>(); for (Class<?> superClass = clazz; superClass != null && superClass != Object.class; superClass = superClass .getSuperclass()) { Method[] f = superClass.getDeclaredMethods(); for (int j = 0; j < f.length; j++) { lf.add(f[j]); } } return lf; } }