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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ServiceDiscovery<T>
forClass(Class<T> theInterface)
Creates a ServiceDiscovery.List<Class<T>>
getImplementor()
Returns a list of classes that implement the service.protected void
parseImplementor(String clazz, ClassLoader cLoader, Set<Class<T>> uniqueClasses)
Parses a list of classes that implement a service.
-
-
-
Method Detail
-
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 loaderuniqueClasses
- Set of classes (output)
-
-