discovery.DiscoveryService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brunner-basic-app Show documentation
Show all versions of brunner-basic-app Show documentation
Default application for the BRunner project
The newest version!
package discovery;
import java.util.Set;
import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
import org.reflections.util.ClasspathHelper;
import org.reflections.util.ConfigurationBuilder;
import org.reflections.util.FilterBuilder;
import api.running.IToolBinding;
public class DiscoveryService {
public static void main(String[] args) {
Reflections reflections = new Reflections(new ConfigurationBuilder()
.setUrls(ClasspathHelper.forJavaClassPath()) // Scan the entire classpath
.setScanners(new SubTypesScanner())
.filterInputsBy(new FilterBuilder().includePackage("com"))); // Adjust the package filter as needed
Set> implementations = reflections.getSubTypesOf(IToolBinding.class);
for (Class extends IToolBinding> implClass : implementations) {
System.out.println("Found implementation: " + implClass.getName());
// Optionally, instantiate and use the implementation
// MyInterface instance = implClass.getDeclaredConstructor().newInstance();
// instance.performAction();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy