Java examples for Reflection:Field Get
get Interfaces Include Super Class
//package com.java2s; 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(getInterfacesIncludeSuperClass(clazz)); }/*from w w w.j a v a2 s.co m*/ public static List<Class<?>> getInterfacesIncludeSuperClass( final Class<?> clazz) { List<Class<?>> types = new ArrayList<Class<?>>(); for (Class<?> superClass = clazz; superClass != Object.class; superClass = superClass .getSuperclass()) { for (Class<?> intf : superClass.getInterfaces()) { if (!types.contains(intf)) { types.add(intf); } } } return types; } }