/** * Taken from PonderUtilCore around version 1.2.2 * - Antranig Basman (antranig@caret.cam.ac.uk) */ private static void appendSuperclasses(Class<?> clazz, List<Class<?>> accrete) { Class<?>[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; ++i) { accrete.add(interfaces[i]); } for (int i = 0; i < interfaces.length; ++i) { appendSuperclasses(interfaces[i], accrete); } }
/** * Taken from PonderUtilCore around version 1.2.2 * - Antranig Basman (antranig@caret.cam.ac.uk) */ private static void appendSuperclasses(Class<?> clazz, List<Class<?>> accrete) { Class<?>[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; ++i) { accrete.add(interfaces[i]); } for (int i = 0; i < interfaces.length; ++i) { appendSuperclasses(interfaces[i], accrete); } }
/** * Returns a list of all superclasses and implemented interfaces by the supplied class, * recursively to the base, up to but excluding Object.class. These will be listed in order from * the supplied class, all concrete superclasses in ascending order, and then finally all * interfaces in recursive ascending order.<br/> * This will include duplicates if any superclasses implement the same classes * * Taken from PonderUtilCore around version 1.2.2 * - Antranig Basman (antranig@caret.cam.ac.uk) */ public static List<Class<?>> getSuperclasses(Class<?> clazz) { List<Class<?>> accumulate = new ArrayList<Class<?>>(); while (clazz != Object.class) { accumulate.add(clazz); clazz = clazz.getSuperclass(); } int supers = accumulate.size(); for (int i = 0; i < supers; ++i) { appendSuperclasses(accumulate.get(i), accumulate); } return accumulate; }
/** * Returns a list of all superclasses and implemented interfaces by the supplied class, * recursively to the base, up to but excluding Object.class. These will be listed in order from * the supplied class, all concrete superclasses in ascending order, and then finally all * interfaces in recursive ascending order.<br/> * This will include duplicates if any superclasses implement the same classes * * Taken from PonderUtilCore around version 1.2.2 * - Antranig Basman (antranig@caret.cam.ac.uk) */ public static List<Class<?>> getSuperclasses(Class<?> clazz) { List<Class<?>> accumulate = new ArrayList<Class<?>>(); while (clazz != Object.class) { accumulate.add(clazz); clazz = clazz.getSuperclass(); } int supers = accumulate.size(); for (int i = 0; i < supers; ++i) { appendSuperclasses(accumulate.get(i), accumulate); } return accumulate; }