All Downloads are FREE. Search and download functionalities are using the official Maven repository.

discovery.DiscoveryService Maven / Gradle / Ivy

There is a newer version: 1.0.5
Show 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 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