@Test public void testExtractAllInterfaces() { final Class<?>[] intfs = Utils.extractAllInterfaces(HashSet.class); final Set<Class<?>> coll = new HashSet<Class<?>>(); Collections.addAll(coll, intfs); Assert.assertTrue(coll.contains(Collection.class)); Assert.assertTrue(coll.contains(Serializable.class)); }
static Class<?>[] extractAllInterfaces(final Class<?> clazz) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Class<?> currClazz = clazz; currClazz != null; currClazz = currClazz.getSuperclass()) { Collections.addAll(interfaces, currClazz.getInterfaces()); } return interfaces.toArray(new Class[interfaces.size()]); }
Utils { static Class<?>[] extractAllInterfaces(final Class<?> clazz) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Class<?> currClazz = clazz; currClazz != null; currClazz = currClazz.getSuperclass()) { Collections.addAll(interfaces, currClazz.getInterfaces()); } return interfaces.toArray(new Class[interfaces.size()]); } }
Utils { static Class<?>[] extractAllInterfaces(final Class<?> clazz) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Class<?> currClazz = clazz; currClazz != null; currClazz = currClazz.getSuperclass()) { Collections.addAll(interfaces, currClazz.getInterfaces()); } return interfaces.toArray(new Class[interfaces.size()]); } private  Utils(); }
Utils { static Class<?>[] extractAllInterfaces(final Class<?> clazz) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Class<?> currClazz = clazz; currClazz != null; currClazz = currClazz.getSuperclass()) { Collections.addAll(interfaces, currClazz.getInterfaces()); } return interfaces.toArray(new Class[interfaces.size()]); } private  Utils();  }
Utils { static Class<?>[] extractAllInterfaces(final Class<?> clazz) { final Set<Class<?>> interfaces = new HashSet<Class<?>>(); for (Class<?> currClazz = clazz; currClazz != null; currClazz = currClazz.getSuperclass()) { Collections.addAll(interfaces, currClazz.getInterfaces()); } return interfaces.toArray(new Class[interfaces.size()]); } private  Utils();   }