Package mondrian.util

Class ServiceDiscovery<T>


  • public class ServiceDiscovery<T>
    extends java.lang.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 Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> ServiceDiscovery<T> forClass​(java.lang.Class<T> theInterface)
      Creates a ServiceDiscovery.
      java.util.List<java.lang.Class<T>> getImplementor()
      Returns a list of classes that implement the service.
      protected void parseImplementor​(java.lang.String clazz, java.lang.ClassLoader cLoader, java.util.Set<java.lang.Class<T>> uniqueClasses)
      Parses a list of classes that implement a service.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • forClass

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

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

        protected void parseImplementor​(java.lang.String clazz,
                                        java.lang.ClassLoader cLoader,
                                        java.util.Set<java.lang.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)