Here you can find the source of getAllInterfaces(Class clazz)
public static Class[] getAllInterfaces(Class clazz)
//package com.java2s; /*// ww w . j a va 2 s.com * JFox - The most lightweight Java EE Application Server! * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn. * * JFox is licenced and re-distributable under GNU LGPL. */ import java.util.ArrayList; import java.util.List; public class Main { public static Class[] getAllInterfaces(Class clazz) { if (clazz == null) { return new Class[0]; } List<Class> classList = new ArrayList<Class>(); while (clazz != null) { Class[] interfaces = clazz.getInterfaces(); for (Class interf : interfaces) { if (!classList.contains(interf)) { classList.add(interf); } Class[] superInterfaces = getAllInterfaces(interf); for (Class superIntf : superInterfaces) { if (!classList.contains(superIntf)) { classList.add(superIntf); } } } clazz = clazz.getSuperclass(); } return classList.toArray(new Class[classList.size()]); } }