Package mondrian.util

Class ServiceDiscovery<T>

java.lang.Object
mondrian.util.ServiceDiscovery<T>

public class ServiceDiscovery<T> extends Object
Utility functions to discover Java services.

Java services are described in the JAR File Specification.

Based on the suggested file format, this class reads the service entries in a JAR file and discovers implementors of an interface.

Author:
Marc Batchelor
  • Method Details

    • forClass

      public static <T> ServiceDiscovery<T> forClass(Class<T> theInterface)
      Creates a ServiceDiscovery.
      Parameters:
      theInterface - Interface for service
      Returns:
      ServiceDiscovery for finding instances of the given interface
    • getImplementor

      public List<Class<T>> getImplementor()
      Returns a list of classes that implement the service.
      Returns:
      List of classes that implement the service
    • parseImplementor

      protected void parseImplementor(String clazz, ClassLoader cLoader, Set<Class<T>> uniqueClasses)
      Parses a list of classes that implement a service.
      Parameters:
      clazz - Class name (or list of class names)
      cLoader - Class loader
      uniqueClasses - Set of classes (output)