Open Jacobvu84 opened 4 years ago
import java.util.HashSet; import java.util.Set; import net.sf.extcos.ComponentQuery; import net.sf.extcos.ComponentScanner; public class FindAllClass { public static void main (String[] args) throws Throwable { Set<Class<? extends MyInterface>> classes = new HashSet<Class<? extends MyInterface>>(); ComponentScanner scanner = new ComponentScanner(); scanner.getClasses(new ComponentQuery() { @Override protected void query() { select(). from("com.betterengage.features"). andStore(thoseImplementing(MyInterface.class).into(classes)). returning(none()); } }); classes.forEach(action->System.out.println(action)); } }
<!-- https://mvnrepository.com/artifact/net.sf.extcos/extcos --> <dependency> <groupId>net.sf.extcos</groupId> <artifactId>extcos</artifactId> <version>0.4b</version> </dependency>