private static Set getAllInterfaces(Class clazz) {
Set allInterfaces = new LinkedHashSet();
LinkedList stack = new LinkedList();
stack.addAll(Arrays.asList(clazz.getInterfaces()));
while (!stack.isEmpty()) {
Class intf = (Class) stack.removeFirst();
if (!allInterfaces.contains(intf)) {
allInterfaces.add(intf);
stack.addAll(Arrays.asList(intf.getInterfaces()));
}
}