ClassFinder { public static <T> Set<Class<? extends T>> findConcreteClasses(Class<T> baseClass) { Set<Class<? extends T>> concreteClasses = findClasses(baseClass); concreteClasses.removeIf(c -> c.isInterface() || Modifier.isAbstract(c.getModifiers())); return concreteClasses; }  static ThreadLocalStack<ServletContext> getThreadDefaultServletContext(); static ThreadLocalStack<ClassFinder> getThreadDefault(); @SuppressWarnings("unchecked") static Set<Class<? extends T>> findClassesFromLoader(ClassLoader loader, Class<T> baseClass); static Set<Class<? extends T>> findClasses(Class<T> baseClass); static Set<Class<? extends T>> findConcreteClasses(Class<T> baseClass); Set<String> getClassLoaderExclusions(); void setClassLoaderExclusions(Set<String> classLoaderExclusions); Set<Class<? extends T>> find(ClassLoader loader, Class<T> baseClass); static final String INCLUDE_ATTRIBUTE; }
@Test public void findConcreteClasses() { assertThat( ClassFinder.findConcreteClasses(Interface.class), is(ImmutableSet.of( ConcreteInterface.class, ConcreteClass.class ))); }